Skip to content

[Bug]: ImportError is ignored completely which can not be detected outside #7837

@JounQin

Description

@JounQin

Kind of Issue

Runtime - command-line tools

Tool or Library

cspell, cspell/eslint-plugin, cspell-lib

Version

9.2.1

Supporting Library

Other

OS

macOS

OS Version

26.0

Description

return new ImportError(`Failed to read config file: "${ref.filename}"`, error);

The error thrown when reading config is ignore completely which makes it resulting same as undefined config content:

return file instanceof Error ? undefined : file;

It could be caused by errors when loading dictionaries like https://github.com/alauda/doom/blob/2ec42a346e046115333711585305f4d0313bcde7/packages/doom/src/cspell.ts#L48, network error, for example. And it should results panic error instead of ignoring.

Steps to Reproduce

// cspell.config.js
const config = () => {
  throw new Error('Mock a runtime error')
}

export default config
cspell

Expected Behavior

There should be panic error

Additional Information

No response

cspell.json

cspell.config.yaml

Example Repository

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions