Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@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
1.0.20
Version published
Weekly downloads
31
-55.71%
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 Oct 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