🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@altizure/errorcode

Package Overview
Dependencies
Maintainers
4
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@altizure/errorcode

i18n of error code

npmnpm
Version
2.0.0
Version published
Weekly downloads
51
-43.96%
Maintainers
4
Weekly downloads
 
Created
Source

Install

yarn add @altizure/errorcode

Usage in front-end (see @ald/ui for more)

import React, { Component } from 'react'
import PropTypes from 'prop-types'
// public package, @altizure/errorcode
import ErrorCode from '@altizure/errorcode'

const mockproject = {
  error: true,
  errorCode: [
    'ERROR_CAMINFO_CAMINTRINSICFILE_EMPTY_FILE',
    'ERROR_UNKNOWN'
  ]
}

@withi18nSSR()
class Report extends Component {
  static propTypes = {
    i18n: PropTypes.object
  }
  render () {
    const lang = langMap[this.props.i18n.lang]
    return mockproject.error ? (
      mockproject.errorCode.map(e => {
        return (
          <div>
            <h1>{ErrorCode[lang][e].ErrorNumber}</h1>
            <h2>{ErrorCode[lang][e].Description}</h2>
            <h2>{ErrorCode[lang][e].Solution}</h2>
          </div>
        )
      })
    ) : (
      <div>
        <p>Project is all good!</p>
      </div>
    )
  }
}

Usage in back-end

const en = require('@altizure/errorcode').en

app.get('/', (req, res) => {
    return res.end(en.ERROR_CAMINFO_EXIF_INVALID_IMAGESIZE.Description)
})

FAQs

Package last updated on 17 Dec 2019

Did you know?

Socket

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.

Install

Related posts