Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/utils/branch-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { log } from './logger';
*/
export const setupBranches = async (config: QueryExportConfig, stackAPIClient: any): Promise<void> => {
if (typeof config !== 'object') {
throw new Error('Invalid config to setup the branch');
throw new Error('The branch configuration is invalid.');
}

try {
Expand All @@ -35,7 +35,7 @@ export const setupBranches = async (config: QueryExportConfig, stackAPIClient: a
if (result && typeof result === 'object') {
log(config, `Branch '${config.branchName}' found`, 'success');
} else {
throw new Error(`No branch found with the name '${config.branchName}'`);
throw new Error(`No branch found named ${config.branchName}.`);
}
} else {
// If no branch name provided, check if the stack has branches
Expand Down
6 changes: 3 additions & 3 deletions src/utils/config-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ export async function setupQueryExportConfig(flags: any): Promise<QueryExportCon
exportQueryConfig.managementToken = token;
exportQueryConfig.stackApiKey = apiKey;
if (!exportQueryConfig.managementToken) {
throw new Error(`No management token found on given alias ${flags.alias}`);
throw new Error(`No management token found for alias ${flags.alias}.`);
}
}

if (!exportQueryConfig.managementToken) {
if (!isAuthenticated()) {
throw new Error('Please login or provide an alias for the management token');
throw new Error('Log in or provide an alias for the management token.');
} else {
exportQueryConfig.stackApiKey = flags['stack-api-key'] || (await askAPIKey());
if (typeof exportQueryConfig.stackApiKey !== 'string') {
throw new Error('Invalid API key received');
throw new Error('The API key is invalid.');
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/dependency-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class ContentTypeDependenciesHandler {
'info',
);
} catch (error) {
log(this.exportQueryConfig, `Error separating extensions and marketplace apps: ${error.message}`, 'error');
log(this.exportQueryConfig, `Failed to separate extensions and Marketplace apps: ${error.message}`, 'error');
// Keep original extensions if separation fails
}
} else {
Expand Down Expand Up @@ -131,7 +131,7 @@ export class ContentTypeDependenciesHandler {

return { extensions: regularExtensions, marketplaceApps };
} catch (error) {
log(this.exportQueryConfig, `Error fetching extensions and marketplace apps: ${error.message}`, 'error');
log(this.exportQueryConfig, `Failed to fetch extensions and Marketplace apps: ${error.message}`, 'error');
return { extensions: extensionUIDs, marketplaceApps: [] };
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/utils/query-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class QueryParser {
const content = fs.readFileSync(filePath, 'utf-8');
return JSON.parse(content);
} catch (error) {
throw new CLIError(`Failed to parse query file: ${error.message}`);
throw new CLIError(`Failed to parse the query file: ${error.message}`);
}
}

Expand All @@ -42,16 +42,16 @@ export class QueryParser {

private validate(query: any): void {
if (!query || typeof query !== 'object') {
throw new CLIError('Query must be a valid JSON object');
throw new CLIError('The query must be a valid JSON object.');
}

if (!query.modules || typeof query.modules !== 'object') {
throw new CLIError('Query must contain a "modules" object');
throw new CLIError('The query must contain a "modules" object.');
}

const modules = Object.keys(query.modules);
if (modules.length === 0) {
throw new CLIError('Query must contain at least one module');
throw new CLIError('The query must contain at least one module.');
}

// Validate supported modules
Expand Down
6 changes: 3 additions & 3 deletions src/utils/referenced-asset-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class AssetReferenceHandler {

return result;
} catch (error) {
log(this.exportQueryConfig, `Error extracting assets: ${error.message}`, 'error');
log(this.exportQueryConfig, `Failed to extract assets: ${error.message}`, 'error');
return [];
}
}
Expand Down Expand Up @@ -89,7 +89,7 @@ export class AssetReferenceHandler {

return entriesCount;
} catch (error) {
log(this.exportQueryConfig, `Error processing file ${filePath}: ${error.message}`, 'warn');
log(this.exportQueryConfig, `Failed to process file ${filePath}: ${error.message}`, 'warn');
return 0;
}
}
Expand Down Expand Up @@ -152,7 +152,7 @@ export class AssetReferenceHandler {
}
}
} catch (error) {
log(this.exportQueryConfig, `Error reading directory ${dir}: ${error.message}`, 'warn');
log(this.exportQueryConfig, `Failed to read directory ${dir}: ${error.message}`, 'warn');
}

return jsonFiles;
Expand Down