Enhance error message
This commit is contained in:
parent
7155c0a7a4
commit
f70f91a6f8
@ -1,6 +1,9 @@
|
|||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
const resolveURL = require('resolve-url');
|
const resolveURL = require('resolve-url');
|
||||||
const { log } = require('../utils/log');
|
const { log } = require('../utils/log');
|
||||||
|
const {
|
||||||
|
CREATE_FFMPEG_CORE_IS_NOT_DEFINED,
|
||||||
|
} = require('../utils/errors');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fetch data from remote URL and convert to blob URL
|
* Fetch data from remote URL and convert to blob URL
|
||||||
@ -38,6 +41,9 @@ module.exports = async ({ corePath: _corePath }) => {
|
|||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
const eventHandler = () => {
|
const eventHandler = () => {
|
||||||
script.removeEventListener('load', eventHandler);
|
script.removeEventListener('load', eventHandler);
|
||||||
|
if (typeof createFFmpegCore === 'undefined') {
|
||||||
|
throw Error(CREATE_FFMPEG_CORE_IS_NOT_DEFINED(coreRemotePath));
|
||||||
|
}
|
||||||
log('info', 'ffmpeg-core.js script loaded');
|
log('info', 'ffmpeg-core.js script loaded');
|
||||||
resolve({
|
resolve({
|
||||||
createFFmpegCore,
|
createFFmpegCore,
|
||||||
|
11
src/utils/errors.js
Normal file
11
src/utils/errors.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const CREATE_FFMPEG_CORE_IS_NOT_DEFINED = (corePath) => (`
|
||||||
|
createFFmpegCore is not defined. ffmpeg.wasm is unable to find createFFmpegCore after loading ffmpeg-core.js from ${corePath}. Use another URL when calling createFFmpeg():
|
||||||
|
|
||||||
|
const ffmpeg = createFFmpeg({
|
||||||
|
corePath: 'http://localhost:3000/ffmpeg-core.js',
|
||||||
|
});
|
||||||
|
`);
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
CREATE_FFMPEG_CORE_IS_NOT_DEFINED,
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user