{"id":21260012,"url":"https://github.com/purwokertodev/http-restify-error","last_synced_at":"2025-03-15T06:43:25.572Z","repository":{"id":57268322,"uuid":"84166914","full_name":"purwokertodev/http-restify-error","owner":"purwokertodev","description":"a custom http error for restify package","archived":false,"fork":false,"pushed_at":"2017-03-07T11:02:31.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T06:13:08.801Z","etag":null,"topics":["restify","restify-server"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/purwokertodev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-07T07:11:24.000Z","updated_at":"2018-11-01T08:57:18.000Z","dependencies_parsed_at":"2022-09-02T02:02:02.217Z","dependency_job_id":null,"html_url":"https://github.com/purwokertodev/http-restify-error","commit_stats":null,"previous_names":["wuriyanto48/http-restify-error"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purwokertodev%2Fhttp-restify-error","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purwokertodev%2Fhttp-restify-error/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purwokertodev%2Fhttp-restify-error/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purwokertodev%2Fhttp-restify-error/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purwokertodev","download_url":"https://codeload.github.com/purwokertodev/http-restify-error/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243695514,"owners_count":20332626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["restify","restify-server"],"created_at":"2024-11-21T04:16:12.876Z","updated_at":"2025-03-15T06:43:25.551Z","avatar_url":"https://github.com/purwokertodev.png","language":"JavaScript","readme":"- SIMPLE HTTP ERROR CUSTOM FOR RESTIFY\n\nWhen you dealing with callback, sometime you confuse which error you need to handle.\nBecause you don't know where the error comes from.\n\nUSAGE:\n\n-repository.js\n\n```javascript\n\n  'use strict'\n\n  const httpError = require('http-restify-error');\n\n  function find(id, cb){\n    cb({error: httpError.ERROR_TYPE.NOT_FOUND, msg: `user with id ${id} not found`}, null);\n  }\n\n  module.exports = find;\n\n```\n\n-handler.js\n\n```javascript\n\n  'use strict';\n\n  const httpError = require('http-restify-error');\n\n  const find = require('./repository');\n\n  function getExample(req, res, next){\n    let id = 1;\n    find(id, (err, data) =\u003e {\n      res.send(httpError.error(err.error, err.msg));\n    });\n  }\n\n  module.exports = {\n    getExample: getExample\n  };\n\n```\n\n-index.js\n\n```javascript\n\n  'use strict';\n\n  const restify = require('restify');\n\n  const handler = require('./handler');\n\n  const server = restify.createServer({\n    versions: \"0.0.1\",\n    name: 'MyApp',\n  });\n\n  server.get('/', (req, res, next) =\u003e {\n    res.send(\"Test........\");\n  });\n\n  server.get('/error-test', handler.getExample);\n\n  server.listen(3000);\n\n```\n This package build from https://github.com/restify/errors\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurwokertodev%2Fhttp-restify-error","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurwokertodev%2Fhttp-restify-error","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurwokertodev%2Fhttp-restify-error/lists"}