     uri+= "?access_token=#{@token}" if @token
     return uri
 
+  errorHandle: (res, body, callback) ->
+    # TODO: Unprocessable entity
+    if res.statusCode is 422 then throw new Error body.message
+    if res.statusCode in [400, 401, 404] then throw new Error body.message
+    callback res.statusCode, body
+
   # Github api GET request
   get: (path, callback) ->
     request

        'Content-Type': 'application/json'
    , (err, res, body) ->
      if err then throw err
      body = JSON.parse body
      # TODO: Unprocessable entity
      if res.statusCode is 422 then throw new Error body.message
      if res.statusCode in [400, 401, 404] then throw new Error body.message
      callback res.statusCode, body

  # Github api DELETE request
  del: (path, content={}, callback) ->

        'Content-Type': 'application/json'
    , (err, res, body) ->
      if err then throw err
      @errorHandle res, JSON.parse(body), callback

  # Github api PUT request
  put: (path, content={}, callback) ->
