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
Post a Comment