mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-15 17:22:25 -05:00
Creating a new database project, project items
* can create, open, and close sqlproj files * can add sql objects to projects
This commit is contained in:
@@ -13,13 +13,21 @@ import { SqlConnectionDataSource } from './sqlConnectionStringSource';
|
||||
export abstract class DataSource {
|
||||
public name: string;
|
||||
public abstract get type(): string;
|
||||
public abstract get friendlyName(): string;
|
||||
public abstract get typeFriendlyName(): string;
|
||||
|
||||
constructor(name: string) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
export class NoDataSourcesFileError extends Error {
|
||||
constructor(message?: string) {
|
||||
super(message);
|
||||
Object.setPrototypeOf(this, new.target.prototype);
|
||||
this.name = NoDataSourcesFileError.name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* parses the specified file to load DataSource objects
|
||||
*/
|
||||
@@ -30,7 +38,8 @@ export async function load(dataSourcesFilePath: string): Promise<DataSource[]> {
|
||||
fileContents = await fs.readFile(dataSourcesFilePath);
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(constants.noDataSourcesFile);
|
||||
// TODO: differentiate between file not existing and other types of failures; need to know whether to prompt to create new
|
||||
throw new NoDataSourcesFileError(constants.noDataSourcesFile);
|
||||
}
|
||||
|
||||
const rawJsonContents = JSON.parse(fileContents.toString());
|
||||
|
||||
Reference in New Issue
Block a user