Return an object with code and message

Signed-off-by: Ian Macalinao <me@ian.pw>