Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: ui/webui/resources/js/assert.js

Issue 604373006: Compile chrome://settings, part 9: yet another final battle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@K_blockers_from_bookmarks
Patch Set: dbeam@'s review Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Assertion support. 6 * @fileoverview Assertion support.
7 */ 7 */
8 8
9 /** 9 /**
10 * Verify |condition| is truthy and return |condition| if so. 10 * Verify |condition| is truthy and return |condition| if so.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 * 47 *
48 * @param {string=} opt_message A message to show when this is hit. 48 * @param {string=} opt_message A message to show when this is hit.
49 */ 49 */
50 function assertNotReached(opt_message) { 50 function assertNotReached(opt_message) {
51 throw new Error(opt_message || 'Unreachable code hit'); 51 throw new Error(opt_message || 'Unreachable code hit');
52 } 52 }
53 53
54 /** 54 /**
55 * @param {*} value The value to check. 55 * @param {*} value The value to check.
56 * @param {function(new: T, ...)} type A user-defined constructor. 56 * @param {function(new: T, ...)} type A user-defined constructor.
57 * @param {string=} opt_message A message to show when this is hit.
57 * @return {T} 58 * @return {T}
58 * @template T 59 * @template T
59 */ 60 */
60 function assertInstanceof(value, type) { 61 function assertInstanceof(value, type, opt_message) {
61 if (!(value instanceof type)) 62 if (!(value instanceof type)) {
62 throw new Error(value + ' is not a[n] ' + (type.name || typeof type)); 63 throw new Error(opt_message ||
64 value + ' is not a[n] ' + (type.name || typeof type));
65 }
63 return value; 66 return value;
64 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698