Skip to content

markglh/Spray-Akka-Json-Error-Handling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##Error handling with Spray (JSON!!)

Following on from Jan's earlier blogs which detail and use a nice error handling mechanism for Spray: errors & failures and AngularJS in Akka and Spray (Now a typesafe activator template). I'm now using this in a production application so the plan is to dive a bit deeper by refining the error handling and elaborating a bit more on the important parts.

###Structural changes First this first, compared to the previous blogs i'll outline what changes I've made to the code structure.

  • More comments - Pretty much speaks for itself
  • Added a default error selector - Undefined instances of Left will automatically fallback to the default handler
  • Restructured code packages slightly - Moved boiler plate code into scaffolding package
  • Tweaked RoutedHttpService to delegate error and rejection handling to the FailureHandling Trait
  • Added FailureHandling Trait- The error handling now falls back on the spray.routing.ExceptionHandler default cases rather than overriding them unnecessarily. All rejections and exceptions are automatically converted to JSON.

#TODO

replaced the rejection handler to pass back to the master for standard errors

lots of examples of request/responses

Dont think I've done the following: Refactored so that all error responses extend a supertype rather than being discrete objects

About

Error Handling in Spray With Spray JSON and Akka

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages