Skip to content

Commit 3d4b1a7

Browse files
committed
Add inner exception to JsonLdError to debug why tests are failing
1 parent da81351 commit 3d4b1a7

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/json-ld.net/Core/DocumentLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public virtual RemoteDocument LoadDocument(string url)
5454
{
5555
throw;
5656
}
57-
catch (Exception)
57+
catch (Exception exception)
5858
{
59-
throw new JsonLdError(JsonLdError.Error.LoadingDocumentFailed, url);
59+
throw new JsonLdError(JsonLdError.Error.LoadingDocumentFailed, url, exception);
6060
}
6161
return doc;
6262
#else

src/json-ld.net/Core/JsonLdError.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,22 @@ public class JsonLdError : Exception
1111
private JsonLdError.Error type;
1212
internal JObject details = null;
1313

14-
public JsonLdError(JsonLdError.Error type, object detail) : base(detail == null ?
15-
string.Empty : detail.ToString())
14+
public JsonLdError(JsonLdError.Error type, object detail, Exception innerException)
15+
: base(detail == null ? string.Empty : detail.ToString(), innerException)
1616
{
1717
// TODO: pretty toString (e.g. print whole json objects)
1818
this.type = type;
1919
}
2020

21-
public JsonLdError(JsonLdError.Error type) : base(string.Empty)
21+
public JsonLdError(JsonLdError.Error type, object detail)
22+
: base(detail == null ? string.Empty : detail.ToString())
23+
{
24+
// TODO: pretty toString (e.g. print whole json objects)
25+
this.type = type;
26+
}
27+
28+
public JsonLdError(JsonLdError.Error type)
29+
: base(string.Empty)
2230
{
2331
this.type = type;
2432
}

0 commit comments

Comments
 (0)