Skip to content

Commit

Permalink
[update] when chimee get fake error from chimee-kernel, do not throw it
Browse files Browse the repository at this point in the history
what: stop throwing fake error
why: it may be normal status passed by error
how: only throw error
  • Loading branch information
toxic-johann committed Mar 5, 2018
1 parent a13b3ff commit 14a3e3e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion __tests__/kernel-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('kernel-events', () => {
test('error check', () => {
const fn = jest.fn();
chimee.on('error', fn);
expect(() => chimee.__dispatcher.kernel.emit('error')).toThrow();
expect(() => chimee.__dispatcher.kernel.emit('error')).not.toThrow();
expect(fn).toHaveBeenCalledTimes(1);
});
});
3 changes: 2 additions & 1 deletion demo/hls/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const player = new window.Chimee({
src: 'https://video-dev.github.io/streams/x36xhzz/x36xhzz.m3u8',
// src: 'https://video-dev.github.io/streams/x36xhzz/x36xhzz.m3u8',
src: 'http://yunxianchang.live.ujne7.com/vod-system-bj/44_176_20170224113626af3a75cd-3508-4bc3-b51f-366fca3c7e39.m3u8',
// 编解码容器
box: 'hls', // flv hls mp4
// dom容器
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"toxic-decorators": "^0.3.8"
},
"devDependencies": {
"@std/esm": "^0.23.0",
"@std/esm": "^0.24.0",
"babel-eslint": "^8.2.2",
"babel-jest": "^22.4.1",
"babel-plugin-external-helpers": "^6.22.0",
Expand All @@ -65,9 +65,9 @@
"babel-preset-stage-0": "^6.24.1",
"chai": "^4.1.2",
"chimee-kernel-flv": "^1.4.10",
"chimee-kernel-hls": "^1.2.0",
"chimee-mobile-player": "0.0.5",
"chimee-plugin-center-state": "0.0.8",
"chimee-kernel-hls": "^1.3.0",
"chimee-mobile-player": "^0.1.1",
"chimee-plugin-center-state": "0.0.10",
"chimee-plugin-controlbar": "^0.4.0",
"chimee-plugin-danmu": "0.0.9",
"chimee-plugin-popup": "0.0.7",
Expand All @@ -87,9 +87,9 @@
"mocha": "^5.0.1",
"npm-check-updates": "^2.13.0",
"pkg-ok": "^2.1.0",
"rollup": "^0.56.2",
"rollup": "^0.56.4",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-commonjs": "^8.3.0",
"rollup-plugin-commonjs": "^8.4.0",
"rollup-plugin-flow-no-whitespace": "^1.0.0",
"rollup-plugin-livereload": "^0.6.0",
"rollup-plugin-node-resolve": "^3.0.3",
Expand Down
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import Dispatcher from './dispatcher/index';
import { isString, isFunction, isElement, isObject, Log } from 'chimee-helper';
import { isString, isFunction, isElement, isObject, Log, isError } from 'chimee-helper';
import Plugin from './dispatcher/plugin';
import { frozen, autobindClass } from 'toxic-decorators';
import VideoWrapper from 'dispatcher/video-wrapper';
Expand Down Expand Up @@ -101,6 +101,7 @@ export default class Chimee extends VideoWrapper {
const errorHandler = this.config.errorHandler || Chimee.config.errorHandler;
if (isFunction(errorHandler)) return errorHandler(error);
if (Chimee.config.silent) return;
throw error;
if (isError(error)) throw error;
else console.error(error);
}
}

0 comments on commit 14a3e3e

Please sign in to comment.