Skip to content
This repository has been archived by the owner on Aug 25, 2018. It is now read-only.

Commit

Permalink
bug in fetchURL error reporting fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlarkworthy committed Aug 28, 2014
1 parent 8f02358 commit 341ab36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
.idea/*
examples/rules.yaml
node_modules/*
rules.json
model.java
Expand Down
6 changes: 4 additions & 2 deletions src/schema.ts
Expand Up @@ -383,7 +383,6 @@ function annotate_schema(node: Json.JValue, parent: any, key: string, api: Schem

export function fetchRef(url:string, model:blaze.Rules): Json.JValue{
//todo: this should probably be routed through tv4's getSchema method properly
if (debug) console.log("fetchRef" + url);

//code nicked from tv4.getSchema:
var baseUrl = url; //not interested in yet
Expand All @@ -395,7 +394,7 @@ export function fetchRef(url:string, model:blaze.Rules): Json.JValue{
var pointerPath = decodeURIComponent(fragment);

if (pointerPath.charAt(0) !== "/") {
return undefined;
throw error.message("$ref URL not starting with / or #/ " + url).on(new Error())
}

var parts = pointerPath.split("/").slice(1);
Expand All @@ -410,6 +409,9 @@ export function fetchRef(url:string, model:blaze.Rules): Json.JValue{

].join("\n"))
}

if (debug) console.log("fetchRef" + url + " retrieved " + JSON.stringify(schema.toJSON()));

return schema;
}
/**
Expand Down

0 comments on commit 341ab36

Please sign in to comment.