feat: better error messages

This commit is contained in:
Nevo David 2025-07-14 16:31:44 +07:00
parent 9b4621c4b2
commit 58211410d1
2 changed files with 3 additions and 9 deletions

View File

@ -125,11 +125,10 @@ export class MediaService {
// @ts-ignore
const functionToCall = video.instance[functionName];
if (typeof functionToCall !== 'function') {
throw new Error(`Function ${functionName} not found on video instance`);
if (typeof functionToCall !== 'function' || this._videoManager.checkAvailableVideoFunction(functionToCall)) {
throw new HttpException(`Function ${functionName} not found on video instance`, 400);
}
this._videoManager.checkAvailableVideoFunction(functionToCall);
return functionToCall(body);
}
}

View File

@ -24,12 +24,7 @@ export class VideoManager {
checkAvailableVideoFunction(method: any) {
const videoFunction = Reflect.getMetadata('video-function', method);
if (!videoFunction) {
throw new Error(
`Method ${method.name} is not a valid video function.`
);
}
return videoFunction;
return !videoFunction;
}
getVideoByName(