oven-sh/bun

Strange formatting of additional to extended from Error class on canary build

Chiusa

#15.999 aperta il 26 dic 2024

 (1 commento) (0 reazioni) (1 assegnatario)Rust (4486 fork)batch import
bugconfirmed buggood first issueruntime

Metriche repository

Star
 (90.348 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

What version of Bun is running?

1.1.42-canary.19+145a7fd92

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What steps can reproduce the bug?

export class TelegramError extends Error {
	constructor(error, method, params) {
		super(error.description);

		this.name = method;
		this.method = method;
		this.params = params;
		this.code = error.error_code;

		if (error.parameters) this.payload = error.parameters;
	}
}

throw new TelegramError({ description: "test", error_code: 1 }, "test", {});

Bun:

PS Z:\PROJECTS\GRAMIO\core> bun .\repr.mjs
1 | export class TelegramError extends Error {
2 |     constructor(error, method, params) {
3 |             super(error.description);
      ^
test: test
 method: "test",
 params: {},
   code: 1,

      at new TelegramError (Z:\PROJECTS\GRAMIO\core\repr.mjs:3:3)
      at Z:\PROJECTS\GRAMIO\core\repr.mjs:14:7

Bun v1.1.42-canary.19+145a7fd92 (Windows x64)

Node:

PS Z:\PROJECTS\GRAMIO\core> node .\repr.mjs 
file:///Z:/PROJECTS/GRAMIO/core/repr.mjs:14
throw new TelegramError({ description: "test", error_code: 1 }, "test", {});
      ^

test: test
    at file:///Z:/PROJECTS/GRAMIO/core/repr.mjs:14:7
    at ModuleJob.run (node:internal/modules/esm/module_job:268:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5) {
  method: 'test',
  params: {},
  code: 1
}

Node.js v22.10.0

https://github.com/oven-sh/bun/pull/15985

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

The same result on WSL

Guida contributor