[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] [commit?] adding an Exception-dump instvar



I'd like to have a way to avoid the backtrace in errors in some cases where they are very common and not severe.

so I'd like to change this:

Exception {
	classvar <>handling = false;
	classvar <>debug = false;

	var <>what, <>backtrace, <>dump=true;

	*new { arg what, dump=true;
		var backtrace;
		if (debug) { backtrace = this.getBackTrace.caller };
		^super.newCopyArgs(what ? this.name, backtrace, dump)
	}
	errorString {
		^"EXCEPTION: " ++ what
	}
	reportError {
		this.errorString.postln;
		if(dump) { this.dumpBackTrace };
	}
	isException { ^true }
}




then we can write:

Error("maybe you should tend not to do this.", false);

objections?


by the way: the backtrace is never used anywhere.
--








.