errno.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. var all = module.exports.all = [
  2. {
  3. errno: -2,
  4. code: 'ENOENT',
  5. description: 'no such file or directory'
  6. },
  7. {
  8. errno: -1,
  9. code: 'UNKNOWN',
  10. description: 'unknown error'
  11. },
  12. {
  13. errno: 0,
  14. code: 'OK',
  15. description: 'success'
  16. },
  17. {
  18. errno: 1,
  19. code: 'EOF',
  20. description: 'end of file'
  21. },
  22. {
  23. errno: 2,
  24. code: 'EADDRINFO',
  25. description: 'getaddrinfo error'
  26. },
  27. {
  28. errno: 3,
  29. code: 'EACCES',
  30. description: 'permission denied'
  31. },
  32. {
  33. errno: 4,
  34. code: 'EAGAIN',
  35. description: 'resource temporarily unavailable'
  36. },
  37. {
  38. errno: 5,
  39. code: 'EADDRINUSE',
  40. description: 'address already in use'
  41. },
  42. {
  43. errno: 6,
  44. code: 'EADDRNOTAVAIL',
  45. description: 'address not available'
  46. },
  47. {
  48. errno: 7,
  49. code: 'EAFNOSUPPORT',
  50. description: 'address family not supported'
  51. },
  52. {
  53. errno: 8,
  54. code: 'EALREADY',
  55. description: 'connection already in progress'
  56. },
  57. {
  58. errno: 9,
  59. code: 'EBADF',
  60. description: 'bad file descriptor'
  61. },
  62. {
  63. errno: 10,
  64. code: 'EBUSY',
  65. description: 'resource busy or locked'
  66. },
  67. {
  68. errno: 11,
  69. code: 'ECONNABORTED',
  70. description: 'software caused connection abort'
  71. },
  72. {
  73. errno: 12,
  74. code: 'ECONNREFUSED',
  75. description: 'connection refused'
  76. },
  77. {
  78. errno: 13,
  79. code: 'ECONNRESET',
  80. description: 'connection reset by peer'
  81. },
  82. {
  83. errno: 14,
  84. code: 'EDESTADDRREQ',
  85. description: 'destination address required'
  86. },
  87. {
  88. errno: 15,
  89. code: 'EFAULT',
  90. description: 'bad address in system call argument'
  91. },
  92. {
  93. errno: 16,
  94. code: 'EHOSTUNREACH',
  95. description: 'host is unreachable'
  96. },
  97. {
  98. errno: 17,
  99. code: 'EINTR',
  100. description: 'interrupted system call'
  101. },
  102. {
  103. errno: 18,
  104. code: 'EINVAL',
  105. description: 'invalid argument'
  106. },
  107. {
  108. errno: 19,
  109. code: 'EISCONN',
  110. description: 'socket is already connected'
  111. },
  112. {
  113. errno: 20,
  114. code: 'EMFILE',
  115. description: 'too many open files'
  116. },
  117. {
  118. errno: 21,
  119. code: 'EMSGSIZE',
  120. description: 'message too long'
  121. },
  122. {
  123. errno: 22,
  124. code: 'ENETDOWN',
  125. description: 'network is down'
  126. },
  127. {
  128. errno: 23,
  129. code: 'ENETUNREACH',
  130. description: 'network is unreachable'
  131. },
  132. {
  133. errno: 24,
  134. code: 'ENFILE',
  135. description: 'file table overflow'
  136. },
  137. {
  138. errno: 25,
  139. code: 'ENOBUFS',
  140. description: 'no buffer space available'
  141. },
  142. {
  143. errno: 26,
  144. code: 'ENOMEM',
  145. description: 'not enough memory'
  146. },
  147. {
  148. errno: 27,
  149. code: 'ENOTDIR',
  150. description: 'not a directory'
  151. },
  152. {
  153. errno: 28,
  154. code: 'EISDIR',
  155. description: 'illegal operation on a directory'
  156. },
  157. {
  158. errno: 29,
  159. code: 'ENONET',
  160. description: 'machine is not on the network'
  161. },
  162. {
  163. errno: 31,
  164. code: 'ENOTCONN',
  165. description: 'socket is not connected'
  166. },
  167. {
  168. errno: 32,
  169. code: 'ENOTSOCK',
  170. description: 'socket operation on non-socket'
  171. },
  172. {
  173. errno: 33,
  174. code: 'ENOTSUP',
  175. description: 'operation not supported on socket'
  176. },
  177. {
  178. errno: 34,
  179. code: 'ENOENT',
  180. description: 'no such file or directory'
  181. },
  182. {
  183. errno: 35,
  184. code: 'ENOSYS',
  185. description: 'function not implemented'
  186. },
  187. {
  188. errno: 36,
  189. code: 'EPIPE',
  190. description: 'broken pipe'
  191. },
  192. {
  193. errno: 37,
  194. code: 'EPROTO',
  195. description: 'protocol error'
  196. },
  197. {
  198. errno: 38,
  199. code: 'EPROTONOSUPPORT',
  200. description: 'protocol not supported'
  201. },
  202. {
  203. errno: 39,
  204. code: 'EPROTOTYPE',
  205. description: 'protocol wrong type for socket'
  206. },
  207. {
  208. errno: 40,
  209. code: 'ETIMEDOUT',
  210. description: 'connection timed out'
  211. },
  212. {
  213. errno: 41,
  214. code: 'ECHARSET',
  215. description: 'invalid Unicode character'
  216. },
  217. {
  218. errno: 42,
  219. code: 'EAIFAMNOSUPPORT',
  220. description: 'address family for hostname not supported'
  221. },
  222. {
  223. errno: 44,
  224. code: 'EAISERVICE',
  225. description: 'servname not supported for ai_socktype'
  226. },
  227. {
  228. errno: 45,
  229. code: 'EAISOCKTYPE',
  230. description: 'ai_socktype not supported'
  231. },
  232. {
  233. errno: 46,
  234. code: 'ESHUTDOWN',
  235. description: 'cannot send after transport endpoint shutdown'
  236. },
  237. {
  238. errno: 47,
  239. code: 'EEXIST',
  240. description: 'file already exists'
  241. },
  242. {
  243. errno: 48,
  244. code: 'ESRCH',
  245. description: 'no such process'
  246. },
  247. {
  248. errno: 49,
  249. code: 'ENAMETOOLONG',
  250. description: 'name too long'
  251. },
  252. {
  253. errno: 50,
  254. code: 'EPERM',
  255. description: 'operation not permitted'
  256. },
  257. {
  258. errno: 51,
  259. code: 'ELOOP',
  260. description: 'too many symbolic links encountered'
  261. },
  262. {
  263. errno: 52,
  264. code: 'EXDEV',
  265. description: 'cross-device link not permitted'
  266. },
  267. {
  268. errno: 53,
  269. code: 'ENOTEMPTY',
  270. description: 'directory not empty'
  271. },
  272. {
  273. errno: 54,
  274. code: 'ENOSPC',
  275. description: 'no space left on device'
  276. },
  277. {
  278. errno: 55,
  279. code: 'EIO',
  280. description: 'i/o error'
  281. },
  282. {
  283. errno: 56,
  284. code: 'EROFS',
  285. description: 'read-only file system'
  286. },
  287. {
  288. errno: 57,
  289. code: 'ENODEV',
  290. description: 'no such device'
  291. },
  292. {
  293. errno: 58,
  294. code: 'ESPIPE',
  295. description: 'invalid seek'
  296. },
  297. {
  298. errno: 59,
  299. code: 'ECANCELED',
  300. description: 'operation canceled'
  301. }
  302. ]
  303. module.exports.errno = {}
  304. module.exports.code = {}
  305. all.forEach(function (error) {
  306. module.exports.errno[error.errno] = error
  307. module.exports.code[error.code] = error
  308. })
  309. module.exports.custom = require('./custom')(module.exports)
  310. module.exports.create = module.exports.custom.createError