Skip to content

Improve JsonApiException for debugging and failure tracking #138

@jaredcnance

Description

@jaredcnance

JsonApiException is mostly designed for transmitting information about the failure to the deserializer in its Errors collection, assuming it is getting caught. i haven't spent much time making sure it's useful from a debugging standpoint.

Example stack trace from a unit test. This is obviously not very useful

[xUnit.net 00:01:12.0336574] MyApp.MyTest [FAIL] [xUnit.net 00:01:12.0354318] JsonApiDotNetCore.Internal.JsonApiException : Failed to deserialize request body [xUnit.net 00:01:12.0366302] Stack Trace: [xUnit.net 00:01:12.0376866] at JsonApiDotNetCore.Serialization.JsonApiDeSerializer.Deserialize(String requestBody) [xUnit.net 00:01:12.0380039] MyTest.cs(103,0): at MyTest.<Can_Create_Items>d__11.MoveNext() [xUnit.net 00:01:12.0385567] --- End of stack trace from previous location where exception was thrown --- [xUnit.net 00:01:12.0387113] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [xUnit.net 00:01:12.0387908] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [xUnit.net 00:01:12.0388605] --- End of stack trace from previous location where exception was thrown --- [xUnit.net 00:01:12.0389626] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [xUnit.net 00:01:12.0390775] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [xUnit.net 00:01:12.0392135] --- End of stack trace from previous location where exception was thrown --- [xUnit.net 00:01:12.0392835] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [xUnit.net 00:01:12.0393470] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions