Skip to content

Commit e902244

Browse files
deekshas8cloud-sdk-js
andauthored
chore: Improve check (#5165)
* improve check * Changes from lint:fix * review --------- Co-authored-by: cloud-sdk-js <[email protected]>
1 parent b17009e commit e902244

File tree

2 files changed

+20
-16
lines changed
  • .github/actions/changesets-fixed-version-bump
  • packages/util/src/logger/format

2 files changed

+20
-16
lines changed

.github/actions/changesets-fixed-version-bump/index.js

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/util/src/logger/format/local.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import chalk from 'chalk';
22
import { format } from 'winston';
3-
import { isNullish } from '../../nullish';
43
import type { TransformableInfo } from 'logform';
54

65
const { combine, timestamp, cli, printf, errors } = format;
@@ -43,14 +42,18 @@ export const local = combine(
4342
export function getMessageOrStack(info: TransformableInfo): string {
4443
const isString = (value: unknown): value is string =>
4544
typeof value === 'string';
45+
// Check if it's an error with a stack trace
46+
const hasStackTrace = info.stack && info.level === 'error';
4647

47-
return !isNullish(info.stack) &&
48-
isString(info.stack) &&
49-
info.level === 'error'
50-
? info.stack
51-
: !isNullish(info.message) && isString(info.message)
52-
? info.message
53-
: '';
48+
if (hasStackTrace && isString(info.stack)) {
49+
return info.stack;
50+
}
51+
52+
if (isString(info.message)) {
53+
return info.message;
54+
}
55+
56+
return '';
5457
}
5558

5659
function localTransformer(info: TransformableInfo): TransformableInfo {

0 commit comments

Comments
 (0)