Skip to content

Commit

Permalink
chore: report errors to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Sep 1, 2024
1 parent 7d4acb7 commit 1e6b792
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scripts/apidocs/processing/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ export class FakerApiDocsProcessingError extends FakerError {
constructor(options: {
type: string;
name: string;
source: string | SourceableNode;
source: SourceableNode;
cause: unknown;
}) {
const { type, name, source, cause } = options;
const sourceText =
typeof source === 'string' ? source : getSourcePathText(source);
const sourceText = getSourcePathText(source);
const causeText = cause instanceof Error ? cause.message : '';
if (process.env.CI_PREFLIGHT === 'true') {
const { filePath, line, column } = getSourcePath(source);
console.log(
`::error file=${filePath},line=${line},col=${column}::Failed to process ${type} '${name}': ${causeText}`
);
}

super(
`Failed to process ${type} '${name}' at ${sourceText} : ${causeText}`,
{
Expand All @@ -25,7 +31,7 @@ export class FakerApiDocsProcessingError extends FakerError {
export function newProcessingError(options: {
type: string;
name: string;
source: string | SourceableNode;
source: SourceableNode;
cause: unknown;
}): FakerApiDocsProcessingError {
const { cause } = options;
Expand Down

0 comments on commit 1e6b792

Please sign in to comment.