WYSIWYG

http://kufli.blogspot.com
http://github.com/karthik20522

Friday, September 6, 2013

Spray.io REST service - Http Error Codes - Lesson 8

View the lessons list at https://github.com/karthik20522/SprayLearning

In the previous post in this series about Spray.io REST API, I talked about simple error handling and rejections. What about errors in the context of RESTful API best practices? From the perspective of the developer consuming your Web API, everything is a black box. When developing their applications, developers depend on well-designed errors when they are troubleshooting and resolving issues when using your API.

There are over 70 HTTP status codes but offcourse we don't need to use all of them. Check out this good Wikipedia entry for all HTTP Status codes. So in Spray, we basically can implement all the status codes in the complete magnet depending on if its an Exception or Rejection.
Checkout out these error/httpStatus code from various RestAPIs:

Labels: ,

Thursday, September 5, 2013

Useful Git Alias and Hooks

Git by itself is very raw and sometime hard to read the console outputs. Following are some of git alias that I tend to use on a daily basis.

git lg

This is a replacement to git log. git log doesn't provide any useful information such as branch name nor it's pretty looking! Yes pretty looking like colors and such. Following git alias solves this mundane problem.
Following is a comparison screenshot of git lg vs git log

Using git log:


Using git lg alias:

git unpushed

Every now and then I try to look for all uncommitted changes. But this quite a pain to look for from git console. Problem solved with the following alias:

git undo

git out-of-the-box doesn't provide an undo option to revert the previous commit. Pain! Following alias intends to solve the problem:


Pre-push hooks

One of the most important hooks that I use is a pre-push hook that executes unit tests before pushing to "master" branch. This is important as it can save broken test cases being pushed to master branch. Following hook script:

Labels: