MCPcopy
hub / github.com/processing/p5.js / fileErrors

Function fileErrors

src/core/friendly_errors/file_errors.js:6–91  ·  view source on GitHub ↗
(p5, fn)

Source from the content-addressed store, hash-verified

4import { translator } from '../internationalization';
5
6function fileErrors(p5, fn){
7 // mapping used by `_friendlyFileLoadError`
8 const fileLoadErrorCases = (num, filePath) => {
9 const suggestion = translator('fes.fileLoadError.suggestion', {
10 filePath,
11 url: 'https://github.com/processing/p5.js/wiki/Local-server'
12 });
13 switch (num) {
14 case 0:
15 return {
16 message: translator('fes.fileLoadError.image', {
17 suggestion
18 }),
19 method: 'loadImage'
20 };
21 case 1:
22 return {
23 message: translator('fes.fileLoadError.xml', {
24 suggestion
25 }),
26 method: 'loadXML'
27 };
28 case 2:
29 return {
30 message: translator('fes.fileLoadError.table', {
31 suggestion
32 }),
33 method: 'loadTable'
34 };
35 case 3:
36 return {
37 message: translator('fes.fileLoadError.strings', {
38 suggestion
39 }),
40 method: 'loadStrings'
41 };
42 case 4:
43 return {
44 message: translator('fes.fileLoadError.font', {
45 suggestion
46 }),
47 method: 'loadFont'
48 };
49 case 5:
50 return {
51 message: translator('fes.fileLoadError.json', {
52 suggestion
53 }),
54 method: 'loadJSON'
55 };
56 case 6:
57 return {
58 message: translator('fes.fileLoadError.bytes', {
59 suggestion
60 }),
61 method: 'loadBytes'
62 };
63 case 7:

Callers 1

file_errors.jsFile · 0.85

Calls 2

fileLoadErrorCasesFunction · 0.85
_friendlyErrorMethod · 0.45

Tested by

no test coverage detected