From a98de54db440e6ff2d54994086b3441233c87a35 Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Fri, 11 Dec 2009 10:58:07 -0800 Subject: [PATCH] A few additions for pretty printing things and getting better error messages --- Foundation/CPBundle.j | 18 +++++++++++++++++- Foundation/CPDictionary.j | 4 ++++ Objective-J/Runtime/file.js | 4 ++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Foundation/CPBundle.j b/Foundation/CPBundle.j index 23d9a2041..7943c580e 100644 --- a/Foundation/CPBundle.j +++ b/Foundation/CPBundle.j @@ -33,6 +33,10 @@ @implementation CPBundle : CPObject { + //properties set up in file.js + //this.path = NULL; + //this.info = NULL; + //this._URIMap = { }; } + (id)alloc @@ -185,13 +189,25 @@ - (void)connection:(CPURLConnection)aConnection didFailWithError:(CPError)anError { - alert("Couldnot find bundle:" + anError) + if ([_delegate respondsToSelector:@selector(bundle:didFailWithError:)]) + [_delegate bundle:self didFailWithError:anError]; + + CPLog.error("Could not find bundle: " + self); } - (void)connectionDidFinishLoading:(CPURLConnection)aConnection { } +- (CPString)description +{ + return [super description] + "(" + path + ")"; +} + @end objj_bundle.prototype.isa = CPBundle; +objj_bundle.prototype.toString = function() +{ + return [this description]; +} diff --git a/Foundation/CPDictionary.j b/Foundation/CPDictionary.j index 50243f1df..52f07651d 100755 --- a/Foundation/CPDictionary.j +++ b/Foundation/CPDictionary.j @@ -609,3 +609,7 @@ @end objj_dictionary.prototype.isa = CPDictionary; +objj_bundle.prototype.toString = function() +{ + return [this description]; +} diff --git a/Objective-J/Runtime/file.js b/Objective-J/Runtime/file.js index d8f006013..50f356451 100644 --- a/Objective-J/Runtime/file.js +++ b/Objective-J/Runtime/file.js @@ -607,10 +607,10 @@ function objj_decompile(aString, bundle) var stream = new objj_markedStream(aString); if (stream.magicNumber() != STATIC_MAGIC_NUMBER) - objj_exception_throw(new objj_exception(OBJJUnrecognizedFormatException, "*** Could not recognize executable code format.")); + objj_exception_throw(new objj_exception(OBJJUnrecognizedFormatException, "*** Could not recognize executable code format in bundle: "+bundle)); if (stream.version() != 1.0) - objj_exception_throw(new objj_exception(OBJJUnrecognizedFormatException, "*** Could not recognize executable code format.")); + objj_exception_throw(new objj_exception(OBJJUnrecognizedFormatException, "*** Could not recognize executable code format in bundle: "+bundle)); var file = NULL, files = [],