Socket
Book a DemoInstallSign in
Socket

issue-reporter

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

issue-reporter

A lib that generates issue reports for unexcepted errors.

0.2.0
latest
Source
npmnpm
Version published
Weekly downloads
813
-29.12%
Maintainers
1
Weekly downloads
 
Created
Source

Welcome to issue-reporter 👋

Version Documentation Maintenance License: Apache--2.0 Twitter: yvonnickfrin

A lib that generates issue reports for unexcepted errors.

🏠 Homepage

Prerequisites

  • npm >=5.5.0
  • node >=10.0.0

Install

yarn add issue-reporter

Usage

const issueReporter = require('issue-reporter')

async function main() {
  try {
    throw new Error('Some unexcepted error')
  } catch (e) {
    await issueReporter({
      error: e,
      user: 'frinyvonnick',
      repo: 'issue-reporter',
    })
  }
}

Output

issue-reporter's output depends on your environment:

If you terminal supports Hyperlinks it will print a friendly error message with a clickable link that opens a form to create a new issue with a prefilled error report on your project.

If your terminal doesn't support Hyperlinks, issue-reporter will copy the error report in your clipboard and print an url that opens a new issue on your project so you can directly paste the report on the issue template.

In case of a CI it will print an url that opens a new issue on your project followed by a full report error in markdown you can copy paste in the issue body.

Options

optiondescriptiontyperequired
errorAn Error instanceErrorrequired
userYou GitHub handlestringrequired
repoThe repository name of your projectstringrequired
envinfoA configuration object that is passed down to envinfoObjectoptional
sectionsCustom sections to add in the error reportArrayoptional
formatReportA function that allows to write your own error report templatefunctionoptional

Advanced examples

With sections

issue-reporter takes an extra option called sections that let you add information specific to your project. You can add as many sections as you want.

const issueReporter = require('issue-reporter')

async function main() {
  try {
    throw new Error('Some unexcepted error')
  } catch (e) {
    await issueReporter({
      error: e,
      user: 'frinyvonnick',
      repo: 'issue-reporter',
      sections: [
        {
          title: "My project specific information",
          content: {
            version: "1.0.1",
            release: "2.0.0",
            commit: "qwej79qwjeqw8euqo8wj8eq8"
          }
        }
      ]
    })
  }
}

With custom formatter

issue-reporter has a default markdown formatter. If you want a more flexible way to format your error reporter you can provide your own formatting function.

const issueReporter = require('issue-reporter')

async function main() {
  try {
    throw new Error('Some unexcepted error')
  } catch (e) {
    await issueReporter({
      error: e,
      user: 'frinyvonnick',
      repo: 'issue-reporter',
      formatReport: (errorReport) => {
        return `## ${errorReport.error.title}
        
        ${errorReport.error.stack}
        
        ## ${errorReport.environment.title}
        
        ${errorReport.environment.markdown}
        `
      },
    })
  }
}

Run tests

yarn run test

Author

👤 Yvonnick FRIN

👤 Franck ABGRALL

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2019 Yvonnick FRIN.
This project is Apache--2.0 licensed.

This README was generated with ❤️ by readme-md-generator

FAQs

Package last updated on 08 Jan 2020

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.