Skip to content

Commit

Permalink
fix(utility): 使用es6标准的私有属性
Browse files Browse the repository at this point in the history
  • Loading branch information
bingtsingw committed Jul 9, 2024
1 parent 9df9b8d commit 202856d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 6 additions & 0 deletions packages/utility/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @xstools/utility

## 0.16.1

### Patch Changes

- 使用es6标准的私有属性

## 0.16.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/utility/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xstools/utility",
"version": "0.16.0",
"version": "0.16.1",
"repository": {
"type": "git",
"url": "https://github.com/bingtsingw/xstools-open"
Expand Down
7 changes: 3 additions & 4 deletions packages/utility/src/exception/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@ export class BaseException extends Error {
public code: string;
public override message: string;

/** @internal */
private _messages: unknown;
#_messages: unknown;

public constructor(status: number, messages: unknown, code: string) {
super();
this.status = status;

const normalizedCode = title(code.replace(/Exception$/, ''));
this.code = snake(`E ${normalizedCode}`).toUpperCase();
this._messages = messages ?? normalizedCode;
this.#_messages = messages ?? normalizedCode;
this.message = this.getFirstMessage();
}

public getFirstMessage(): string {
const messages = this._messages;
const messages = this.#_messages;

if (typeof messages === 'string') {
return messages;
Expand Down

0 comments on commit 202856d

Please sign in to comment.