Skip to content

Create Exception class #259

@nexushoratio

Description

@nexushoratio

Inheriting from Error does NOT update the name property, so new exceptions will show the wrong name. Overriding to use this.constructor.name is common.

Currently, all of our custom ones override the constructor, but providing a get name() works as well. We should do that, and update all modules to use it for module level exceptions.

The xunit library has a special case inside TestCase that could be move away from the ctor to a getter as well.

  • Implement and export
  • Update main modules to use newer version of base.
  • Update various modules to use this instead of each having their own custom
  • Update xunit's special case
  • Update main modules to use newest versions of all libraries and new class name
  • Retire old class name from various libraries

Starting state:

$ grep extends.Error **/*.js
lib/userscript.js:  class UserscriptError extends Error {
lib/widget.js:  class WidgetError extends Error {
lib/xunit.js:    static Error = class extends Error {
linkedin-tool.user.js:    static Error = class extends Error {

Metadata

Metadata

Assignees

Labels

cleanupThis doesn't seem right, refactor, etclibraryFor librarieslinkedin-toolFor the LinkedIn Tool userscript

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions