scala - How to manually throw HTTP 404 Not Found exception in spray/akka? -


in repository function, i'm reading user, updating user:

def update(u: user): future[int] = {     this.read(u.id).flatmap {       case some(existinguser) =>         db.run(           usertable             .filter(_.id === user.id)             .update(user.copy(createddate = existinguser.createddate)))       //case none => throw new notfoundexception(); // exception exist in spray/akka?     } } 

i'd throw sort of exception here when user not found, spray/akka know exception means return http 404 not found.

does spray/akka contain sort of notfoundexception can manually throw?

you can throw exception , configure exception handler convert exception 404 response.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -