mirror of
https://github.com/fankes/moshi.git
synced 2025-10-19 16:09:21 +08:00
Merge pull request #168 from square/jw/cause
Propagate adapter method exception cause.
This commit is contained in:
@@ -64,8 +64,9 @@ final class AdapterMethodsFactory implements JsonAdapter.Factory {
|
|||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
if (e.getCause() instanceof IOException) throw (IOException) e.getCause();
|
Throwable cause = e.getCause();
|
||||||
throw new JsonDataException(e.getCause() + " at " + writer.getPath());
|
if (cause instanceof IOException) throw (IOException) cause;
|
||||||
|
throw new JsonDataException(cause + " at " + writer.getPath(), cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,8 +83,9 @@ final class AdapterMethodsFactory implements JsonAdapter.Factory {
|
|||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
if (e.getCause() instanceof IOException) throw (IOException) e.getCause();
|
Throwable cause = e.getCause();
|
||||||
throw new JsonDataException(e.getCause() + " at " + reader.getPath());
|
if (cause instanceof IOException) throw (IOException) cause;
|
||||||
|
throw new JsonDataException(cause + " at " + reader.getPath(), cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user