remove duplicated error utils

This commit is contained in:
Johannes Rieken
2016-05-23 15:50:40 +02:00
parent 4b999b2e87
commit 8a5a178530
2 changed files with 8 additions and 16 deletions

View File

@@ -5,6 +5,7 @@
'use strict';
import URI from 'vs/base/common/uri';
import {readonly, illegalArgument} from 'vs/base/common/errors';
import {IdGenerator} from 'vs/base/common/idGenerator';
import Event, {Emitter} from 'vs/base/common/event';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
@@ -268,24 +269,13 @@ export class TextEditorEdit {
setEndOfLine(endOfLine:EndOfLine): void {
if (endOfLine !== EndOfLine.LF && endOfLine !== EndOfLine.CRLF) {
throw illegalArg('endOfLine');
throw illegalArgument('endOfLine');
}
this._setEndOfLine = endOfLine;
}
}
function readonly(name: string, alt?: string) {
let message = `The property '${name}' is readonly.`;
if (alt) {
message += ` Use '${alt}' instead.`;
}
return new Error(message);
}
function illegalArg(name: string) {
return new Error(`illgeal argument '${name}'`);
}
function deprecated(name: string, message: string = 'Refer to the documentation for further details.') {
return (target: Object, key: string, descriptor: TypedPropertyDescriptor<any>) => {
@@ -379,7 +369,7 @@ class ExtHostTextEditor implements vscode.TextEditor {
set selection(value: Selection) {
if (!(value instanceof Selection)) {
throw illegalArg('selection');
throw illegalArgument('selection');
}
this._selections = [value];
this._trySetSelection(true);
@@ -391,7 +381,7 @@ class ExtHostTextEditor implements vscode.TextEditor {
set selections(value: Selection[]) {
if (!Array.isArray(value) || value.some(a => !(a instanceof Selection))) {
throw illegalArg('selections');
throw illegalArgument('selections');
}
this._selections = value;
this._trySetSelection(true);