Name
global.ErrorMsg
Description
Class providing a way to reliably extract a meaningful error message from whatever was thrown to a catch block.
Script
gs.include("PrototypeServer");
/*
* Implements a mechanism to reliably extract a meaningful error message from whatever was thrown to a catch block.
*/
var ErrorMsg = Class.create();
ErrorMsg.prototype = {
initialize: function(msg, error) {
this.msg = msg;
this.errMsg = '' + error;
if (error instanceof Error)
this.errMsg = error.name + ' - ' + error.message;
},
toString: function() {
return this.msg + this.errMsg;
},
type: 'ErrorMsg'
}
Sys ID
1fc9ec830ab301bf00a5b6983bd78225