Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@architect/docs

Package Overview
Dependencies
Maintainers
6
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@architect/docs - npm Package Compare versions

Comparing version 30.1.38 to 30.1.39

40

en/aws/guides-http.md

@@ -10,4 +10,2 @@ # HTTP

> Coming soon: `text/css` and `text/javscript`
## Request

@@ -115,2 +113,40 @@

## Errors
A `res` may also be invoked with an instance of `Error`.
```javascript
var arc = require('@architect/functions')
// something went wrong!
function fail(req, res) {
res(Error('internal "server" error'))
}
exports.handler = arc.html.get(fail)
```
By default an `Error` returns with an HTTP status code `500`. If the `Error` passed to `res` contains a property of `code`, `status` or `statusCode` with a value of `403`, `404` or `500` the status code response is updated accordingly.
### Custom Error Page
The default error response template can be overridden by adding `error.js` that exports a single default function that accepts an `Error` and returns a non empty `String`.
```javascript
// src/html/get-index/error.js
module.exports = function error(err) {
return `
<!doctype html>
<html>
<body>
<h1>${err.message}</h1>
<pre>${err.stack}</pre>
</body>
</html>
`
}
```
> Have a look at the [error examples repo](https://github.com/arc-repos/arc-example-errors) and demos at https://wut0.click
## Sessions

@@ -117,0 +153,0 @@

2

package.json
{
"name": "@architect/docs",
"version": "30.1.38",
"version": "30.1.39",
"main": "index",

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc