MCPcopy Create free account
hub / github.com/Exrick/xpay / errorToStringShim

Function errorToStringShim

xpay-code/src/main/resources/static/swagger/swagger-ui.js:3005–3028  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3003
3004 if (String(new RangeError('test')) !== 'RangeError: test') {
3005 var errorToStringShim = function toString() {
3006 if (typeof this === 'undefined' || this === null) {
3007 throw new TypeError("can't convert " + this + ' to object');
3008 }
3009 var name = this.name;
3010 if (typeof name === 'undefined') {
3011 name = 'Error';
3012 } else if (typeof name !== 'string') {
3013 name = $String(name);
3014 }
3015 var msg = this.message;
3016 if (typeof msg === 'undefined') {
3017 msg = '';
3018 } else if (typeof msg !== 'string') {
3019 msg = $String(msg);
3020 }
3021 if (!name) {
3022 return msg;
3023 }
3024 if (!msg) {
3025 return name;
3026 }
3027 return name + ': ' + msg;
3028 };
3029 // can't use defineProperties here because of toString enumeration issue in IE <= 8
3030 Error.prototype.toString = errorToStringShim;
3031 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected