Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@agape/exception
Advanced tools
Readme
Errors with status codes
import { Exception } from '@agape/exception'
throw new Exception(404)
throw new Exception(404, "Could not find record with id " + id)
throw new Exception("Something bad happened")
throw new Exception(400, "Something bad happened")
Exception
status
Number that corresponds with HTTP Error Codes
statusText
Accompanying text for the status code
message
A user friendly error message
The constructor in it's various forms is built to do what I mean;
accepting either a status
code, a message
, or both as parameters.
The three argument form allows setting a custom statusText
.
Setting just the status
code results in an exception where the message
and statusText
are populated automatically.
const e = new Exception(500)
e.status /* 500 */
e.statusText /* Internal Server Error */
e.message /* Internal Server Error */
Setting just the message
results in a 400 Bad Request
error.
const e = new Exception("Invalid data")
e.status /* 400 */
e.statusText /* Bad Request */
e.message /* Invalid data */
The statusText
can be set in the three argument form.
const e = new Exception(404, "Silly Not Found", "Oops, couldn't find that")
e.status /* 404 */
e.statusText /* Silly Not Found */
e.message /* Oops, couldn't find that */
Maverik Minett maverik.minett@gmail.com
© 2023 Maverik Minett
MIT
FAQs
Error with status code
The npm package @agape/exception receives a total of 1 weekly downloads. As such, @agape/exception popularity was classified as not popular.
We found that @agape/exception demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.