mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
More verbose errors
This commit is contained in:
parent
3717fe16c1
commit
574a9d9d25
@ -91,14 +91,17 @@ export class AtlasSprite extends BaseSprite {
|
||||
|
||||
const link = this.linksByResolution[ORIGINAL_SPRITE_SCALE];
|
||||
|
||||
assert(
|
||||
link,
|
||||
"Link not known: " +
|
||||
ORIGINAL_SPRITE_SCALE +
|
||||
" (having " +
|
||||
Object.keys(this.linksByResolution) +
|
||||
")"
|
||||
);
|
||||
if (!link) {
|
||||
throw new Error(
|
||||
"draw: Link for " +
|
||||
this.spriteName +
|
||||
" not known: " +
|
||||
ORIGINAL_SPRITE_SCALE +
|
||||
" (having " +
|
||||
Object.keys(this.linksByResolution) +
|
||||
")"
|
||||
);
|
||||
}
|
||||
|
||||
const width = w || link.w;
|
||||
const height = h || link.h;
|
||||
@ -166,7 +169,15 @@ export class AtlasSprite extends BaseSprite {
|
||||
const link = this.linksByResolution[scale];
|
||||
|
||||
if (!link) {
|
||||
assert(false, `Link not known: ${scale} (having ${Object.keys(this.linksByResolution)})`);
|
||||
throw new Error(
|
||||
"drawCached: Link for " +
|
||||
this.spriteName +
|
||||
" at scale " +
|
||||
scale +
|
||||
" not known (having " +
|
||||
Object.keys(this.linksByResolution) +
|
||||
")"
|
||||
);
|
||||
}
|
||||
|
||||
const scaleW = w / link.w;
|
||||
@ -244,7 +255,15 @@ export class AtlasSprite extends BaseSprite {
|
||||
const link = this.linksByResolution[scale];
|
||||
|
||||
if (!link) {
|
||||
assert(false, `Link not known: ${scale} (having ${Object.keys(this.linksByResolution)})`);
|
||||
throw new Error(
|
||||
"drawCachedWithClipRect: Link for " +
|
||||
this.spriteName +
|
||||
" at scale " +
|
||||
scale +
|
||||
" not known (having " +
|
||||
Object.keys(this.linksByResolution) +
|
||||
")"
|
||||
);
|
||||
}
|
||||
|
||||
const scaleW = w / link.w;
|
||||
@ -298,6 +317,17 @@ export class AtlasSprite extends BaseSprite {
|
||||
getAsHTML(w, h) {
|
||||
const link = this.linksByResolution["0.5"];
|
||||
|
||||
if (!link) {
|
||||
throw new Error(
|
||||
"getAsHTML: Link for " +
|
||||
this.spriteName +
|
||||
" at scale 0.5" +
|
||||
" not known (having " +
|
||||
Object.keys(this.linksByResolution) +
|
||||
")"
|
||||
);
|
||||
}
|
||||
|
||||
// Find out how much we have to scale it so that it fits
|
||||
const scaleX = w / link.w;
|
||||
const scaleY = h / link.h;
|
||||
|
Loading…
Reference in New Issue
Block a user