2023-04-11 05:56:26 +00:00
|
|
|
import {ISandbox} from 'app/server/lib/ISandbox';
|
|
|
|
|
2023-05-23 19:03:50 +00:00
|
|
|
export class UnavailableSandboxMethodError extends Error {
|
|
|
|
constructor(message: string) {
|
|
|
|
super(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-11 05:56:26 +00:00
|
|
|
export class NullSandbox implements ISandbox {
|
|
|
|
public async shutdown(): Promise<unknown> {
|
2023-05-23 19:03:50 +00:00
|
|
|
throw new UnavailableSandboxMethodError('shutdown is not available');
|
2023-04-11 05:56:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public async pyCall(_funcName: string, ..._varArgs: unknown[]) {
|
2023-05-23 19:03:50 +00:00
|
|
|
throw new UnavailableSandboxMethodError('pyCall is not available');
|
2023-04-11 05:56:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public async reportMemoryUsage() {
|
2023-05-23 19:03:50 +00:00
|
|
|
throw new UnavailableSandboxMethodError('reportMemoryUsage is not available');
|
2023-04-11 05:56:26 +00:00
|
|
|
}
|
|
|
|
}
|