Skip to content
Snippets Groups Projects
Commit f8ec728d authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Returning null from a constuctor is silly

Throw an error instead.  This should help DigitalMan debug his issue.
parent 711a2e3e
No related branches found
No related tags found
No related merge requests found
...@@ -71,7 +71,7 @@ function RecordFile(filename, definition) ...@@ -71,7 +71,7 @@ function RecordFile(filename, definition)
this.RecordLength=getRecordLength(this.fields); this.RecordLength=getRecordLength(this.fields);
// A vbuf of a record length prevents more than one record from being in the buffer. // A vbuf of a record length prevents more than one record from being in the buffer.
if(!this.file.open(file_exists(this.file.name)?"rb+":"wb+",true,this.RecordLength)) { if(!this.file.open(file_exists(this.file.name)?"rb+":"wb+",true,this.RecordLength)) {
return(null); throw new Error("Failed to open file "+this.file.name);
} }
Object.defineProperty(this, 'length', { Object.defineProperty(this, 'length', {
enumerable: true, enumerable: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment