File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
services/output/strategies Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 11import { CliError } from './cli-error' ;
22
3- export const DEFAULT_TEMPLATE = '{{{message}}}' ;
4-
53export class NetworkError extends CliError {
64 private static readonly CODE = 'NETWORK_ERROR' ;
75 private static readonly TEMPLATE = `
8- {{{ message}}}\n
9- {{#if context.apiMessages}}{{#if (gt (length context.apiMessages) 0)}}
10- Detailed message:\n
11- {{#each context.apiMessages}}
12- • {{this}}\n {{/each}}
13- {{/if}}{{/if}}
14- `. trim ( ) ;
6+ {{ message}}
7+ {{#if context.apiMessages}}{{#if (gt (length context.apiMessages) 0)}}
8+ Detailed error message:
9+ {{#each context.apiMessages}}
10+ • {{this}}{{/each}}
11+ {{/if}}{{/if}}
12+ ` . trim ( ) ;
1513
1614 constructor (
1715 message : string ,
Original file line number Diff line number Diff line change @@ -78,6 +78,13 @@ export class TemplateOutputStrategy implements OutputFormatterStrategy {
7878 return value + 1 ;
7979 } ) ;
8080
81+ // Helper for array/string length
82+ Handlebars . registerHelper ( 'length' , function ( value : unknown ) {
83+ if ( Array . isArray ( value ) ) return value . length ;
84+ if ( typeof value === 'string' ) return value . length ;
85+ return 0 ;
86+ } ) ;
87+
8188 // Helper for conditional rendering
8289 Handlebars . registerHelper (
8390 'if_eq' ,
You can’t perform that action at this time.
0 commit comments