forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert default to named exports - errors (elastic#10986)
* Convert default to named exports - errors * Make all error classes use class syntax and extends add tests * Extending Error apparently doesn't work * Merge PR elastic#11004 to try to fix test failures
- Loading branch information
1 parent
ee2219d
commit 57a70bb
Showing
20 changed files
with
267 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import expect from 'expect.js'; | ||
import { | ||
SearchTimeout, | ||
RequestFailure, | ||
FetchFailure, | ||
ShardFailure, | ||
VersionConflict, | ||
MappingConflict, | ||
RestrictedMapping, | ||
CacheWriteFailure, | ||
FieldNotFoundInCache, | ||
DuplicateField, | ||
SavedObjectNotFound, | ||
IndexPatternMissingIndices, | ||
NoDefinedIndexPatterns, | ||
NoDefaultIndexPattern, | ||
PersistedStateError, | ||
VislibError, | ||
ContainerTooSmall, | ||
InvalidWiggleSelection, | ||
PieContainsAllZeros, | ||
InvalidLogScaleValues, | ||
StackedBarChartConfig, | ||
NotEnoughData, | ||
NoResults, | ||
KbnError | ||
} from 'ui/errors'; | ||
|
||
describe('ui/errors', () => { | ||
const errors = [ | ||
new SearchTimeout(), | ||
new RequestFailure('an error', { }), | ||
new FetchFailure({ }), | ||
new ShardFailure({ '_shards' : 5 }), | ||
new VersionConflict({ }), | ||
new MappingConflict({ }), | ||
new RestrictedMapping('field', 'indexPattern'), | ||
new CacheWriteFailure(), | ||
new FieldNotFoundInCache('aname'), | ||
new DuplicateField('dupfield'), | ||
new SavedObjectNotFound('dashboard', '123'), | ||
new IndexPatternMissingIndices(), | ||
new NoDefinedIndexPatterns(), | ||
new NoDefaultIndexPattern(), | ||
new PersistedStateError(), | ||
new VislibError('err'), | ||
new ContainerTooSmall(), | ||
new InvalidWiggleSelection(), | ||
new PieContainsAllZeros(), | ||
new InvalidLogScaleValues(), | ||
new StackedBarChartConfig('err'), | ||
new NotEnoughData('nodata'), | ||
new NoResults() | ||
]; | ||
|
||
errors.forEach(error => { | ||
const className = error.constructor.name; | ||
it(`${className} has a message`, () => { | ||
expect(error.message).to.not.be.empty(); | ||
}); | ||
|
||
it(`${className} has a stack trace`, () => { | ||
expect(error.stack).to.not.be.empty(); | ||
}); | ||
|
||
it (`${className} is an instance of KbnError`, () => { | ||
expect(error instanceof KbnError).to.be(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.