Skip to content

Commit 9468550

Browse files
committed
Improve validation error messages
1 parent da1e4d4 commit 9468550

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/client/pages/items/show.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export const ItemsShow = () => {
124124
<MaterialSymbol fill={true} css={exclamationIconStyle}>
125125
error
126126
</MaterialSymbol>
127-
<div css={errorMessageBodyStyle}>{errorMessage}</div>
127+
<div>{errorMessage}</div>
128128
</p>
129129
))}
130130
</div>
@@ -184,7 +184,3 @@ const errorStyle = css({
184184
display: "flex",
185185
marginTop: getSpace(3 / 2),
186186
});
187-
188-
const errorMessageBodyStyle = css({
189-
whiteSpace: "pre",
190-
});

src/commands/publish.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,15 @@ export const publish = async (argv: string[]) => {
6565
return acc;
6666
}, [] as { name: string; errors: string[] }[]);
6767
if (invalidItemMessages.length > 0) {
68-
console.error("Validation error:");
68+
const chalk = (await import("chalk")).default;
6969
invalidItemMessages.forEach((msg) => {
70-
console.error(msg.name, msg.errors);
70+
msg.errors.forEach((err) => {
71+
const errorName = chalk.red.bold(msg.name + ":");
72+
const errorDescription = chalk.red(err);
73+
console.error(`${errorName} ${errorDescription}`);
74+
});
7175
});
76+
7277
process.exit(1);
7378
}
7479

src/lib/check-frontmatter-type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const checkOrganizationUrlName: CheckType = {
6565

6666
const checkSlide: CheckType = {
6767
getMessage: () =>
68-
"slideの設定はtrue/falseで入力してください\n\n【破壊的な変更がありました】\n詳しくは以下のリリースをご確認ください\nhttps://github.com/increments/qiita-cli/releases/tag/v0.5.0",
68+
"slideの設定はtrue/falseで入力してください破壊的な変更がありました。詳しくはリリースをご確認ください https://github.com/increments/qiita-cli/releases/tag/v0.5.0",
6969
isValid: ({ slide }) => {
7070
return typeof slide === "boolean";
7171
},

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy