Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Biome encountered an unexpected error | internalError / panic #2724

Closed
1 task done
Tandashi opened this issue May 5, 2024 · 1 comment
Closed
1 task done

Comments

@Tandashi
Copy link

Tandashi commented May 5, 2024

Environment information

CLI:
  Version:                      1.7.2
  Color support:                true

Platform:
  CPU Architecture:             x86_64        
  OS:                           windows       

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.11.0"    
  JS_RUNTIME_NAME:              "node"        
  NODE_PACKAGE_MANAGER:         "pnpm/9.0.6"  

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Workspace:
  Open Documents:               0

What happened?

> pnpm biome check --apply .

Source Location: crates\biome_js_semantic\src\semantic_model\scope.rs:115:33
Thread Name: biome::worker_9
Message: no entry found for key

.\src\option.ts internalError/panic  INTERNAL  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × processing panicked: no entry found for key
// src/option.ts
import type * as tslog from 'tslog';

export type OptionResultSuccess<R> = [R] extends [never]
  ? { type: 'success' }
  : { type: 'success'; result: R };

export type OptionResultError<E extends string = never> = {
  type: 'error';
  error: E | 'unknown';
  message: string;
};

export type OptionResult<R, E extends string = never> =
  | OptionResultSuccess<R>
  | OptionResultError<E>;

export const wrapWithOption = async <R, E extends string = never>(
  func: () => Promise<OptionResult<R, E>> | OptionResult<R, E>,
  logger: tslog.Logger<unknown>,
): Promise<OptionResult<R, E>> => {
  try {
    return await func();
  } catch (e) {
    logger.error(e);

    if (e instanceof Error) {
      return { type: 'error', error: 'unknown', message: e.message };
    }

    if (typeof e === 'string') {
      return { type: 'error', error: 'unknown', message: e };
    }

    return { type: 'error', error: 'unknown', message: 'Unknown error' };
  }
};

export const allOptionsSuccessful = <R, E extends string>(
  options: OptionResult<R, E>[],
): options is OptionResultSuccess<R>[] =>
  options.every((option) => option.type === 'success');

Expected result

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Tandashi
Copy link
Author

Tandashi commented May 5, 2024

Duplicate of #2683, #2680 and #2659.

@Tandashi Tandashi closed this as completed May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant