iso-error plugin for Google Cloud API design
npm install iso-error-google-cloud-api[![NPM version][npm-image]][npm-url]
[![NPM downloads][downloads-image]][downloads-url]
[![Codecov][codecov-image]][codecov-url]
iso-error plugin for Google Cloud API design.
Since iso-error is about sending data across physical boundary,
the DebugInfo is removed for security purpose.
``sh`
yarn add iso-error-google-cloud-api
`ts
// server
import { IsoError } from 'iso-error'
import { googleCloudApiPlugin } from 'iso-error-google-cloud-api'
IsoError.addPlugin(googleCloudApiPlugin)
try {
doSomeWorkThatThrows()
}
catch (e) {
const ge = convertToGoogleError(e)
response.emit(IsoError.serialize(ge))
}
`
`ts
// client
import { IsoError } from 'iso-error'
import { googleCloudApiPlugin } from 'iso-error-google-cloud-api'
IsoError.addPlugin(googleCloudApiPlugin)
try {
fetch('
if (!response.ok) {
throw IsoError.deserialize(response.text())
}
})
}
``
[codecov-image]: https://codecov.io/gh/unional/iso-error-google-cloud-api/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/unional/iso-error-google-cloud-api
[downloads-image]: https://img.shields.io/npm/dm/iso-error-google-cloud-api.svg?style=flat
[downloads-url]: https://npmjs.org/package/iso-error-google-cloud-api
[npm-image]: https://img.shields.io/npm/v/iso-error-google-cloud-api.svg?style=flat
[npm-url]: https://npmjs.org/package/iso-error-google-cloud-api