Skip to content

Commit

Permalink
change the error type when an unexpected error occurs. (string -> obj…
Browse files Browse the repository at this point in the history
…ect)
  • Loading branch information
egg- committed Nov 5, 2020
1 parent 294b593 commit ca3fb9d
Show file tree
Hide file tree
Showing 21 changed files with 23 additions and 20 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 2.5.1
* change the error type when an unexpected error occurs. (string -> object)

# 2.5.0
* add j&t express

Expand Down
2 changes: 1 addition & 1 deletion lib/courier/airbridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module.exports = function (opts) {
var result = parser.trace(body, number)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/auspost.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module.exports = function (opts) {
var results = parser.trace(body.QueryTrackEventsResponse.TrackingResults)
cb(results[0] ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), results[0])
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/cesco.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ module.exports = function (opts) {
result.number = number
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/cjkoreaexpress.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module.exports = function (opts) {
var result = parser.trace(body)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/ecargo.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module.exports = function (opts) {
var result = parser.trace(body)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/efs.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module.exports = function (opts) {
var result = parser.trace(body)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/fedex.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ module.exports = function (opts) {
var results = parser.trace(body.TrackPackagesResponse.packageList)
cb(null, results[0])
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/jnt.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = function () {
var result = parser.trace(JSON.parse(body.data))
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/kerrythai.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module.exports = function () {
var result = parser.trace(body, number)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/koreapost.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ module.exports = function (opts) {
var result = parser.trace(body)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/lbc.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ module.exports = function () {
var result = parser.trace(body, number)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/poslaju.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module.exports = function (opts) {
try {
parser.trace(body, cb)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
}
], cb)
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/rincos.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ module.exports = function (opts) {
try {
parser.trace(body, cb)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
}
], cb)
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/royalmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module.exports = function (opts) {
var result = parser.trace(body)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/sicepat.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ module.exports = function (opts) {
var result = handler.parser.trace(body, number)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/tnt.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module.exports = function (opts) {
var result = parser.trace(output, number)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/usps.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module.exports = function (opts) {
var result = parser.trace(body)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/xioexpress.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module.exports = function (opts) {
var result = parser.trace(body, number)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/courier/yelloexpress.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module.exports = function (opts) {
var result = parser.trace(body)
cb(result ? null : tracker.error(tracker.ERROR.INVALID_NUMBER), result)
} catch (e) {
cb(e.message)
cb(tracker.error(e.message))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "delivery-tracker",
"version": "2.5.0",
"version": "2.5.1",
"author": {
"name": "egg",
"email": "[email protected]"
Expand Down

0 comments on commit ca3fb9d

Please sign in to comment.