{"action":"created","issue":{"url":"https://api.github.com/repos/photonstorm/phaser/issues/1556","labels_url":"https://api.github.com/repos/photonstorm/phaser/issues/1556/labels{/name}","comments_url":"https://api.github.com/repos/photonstorm/phaser/issues/1556/comments","events_url":"https://api.github.com/repos/photonstorm/phaser/issues/1556/events","html_url":"https://github.com/photonstorm/phaser/issues/1556","id":55099705,"number":1556,"title":"Better handling of 'Texture Error: frame does not fit inside the base Texture dimensions'","user":{"login":"fyyyyy","id":3744048,"avatar_url":"https://avatars.githubusercontent.com/u/3744048?v=3","gravatar_id":"","url":"https://api.github.com/users/fyyyyy","html_url":"https://github.com/fyyyyy","followers_url":"https://api.github.com/users/fyyyyy/followers","following_url":"https://api.github.com/users/fyyyyy/following{/other_user}","gists_url":"https://api.github.com/users/fyyyyy/gists{/gist_id}","starred_url":"https://api.github.com/users/fyyyyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fyyyyy/subscriptions","organizations_url":"https://api.github.com/users/fyyyyy/orgs","repos_url":"https://api.github.com/users/fyyyyy/repos","events_url":"https://api.github.com/users/fyyyyy/events{/privacy}","received_events_url":"https://api.github.com/users/fyyyyy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-01-22T00:48:10Z","updated_at":"2015-01-26T02:43:22Z","closed_at":null,"body":"Hey there\r\nI have a game where users can upload their own spritesheets. However when they make a mistake, e.g. a sprite that is 1 pixel too narrow, the error 'Texture Error: frame does not fit inside the base Texture dimensions' is thrown in the console. And the entire game stops loading. I currently do not see a way to try/catch that inside my game code. Is it possible to allow the the game developer to handle this exception ?\r\nOr to provide a function to \"test\" assets before loading them\r\n\r\nThanks :+1: \r\n\r\nMy current workaround is\r\n\r\n```javascript\r\nPIXI.Texture.prototype.setFrame = function(frame)\r\n{\r\n\r\n   ...\r\n\r\n    if (!this.trim && (frame.x + frame.width > this.baseTexture.width || frame.y + frame.height > this.baseTexture.height))\r\n    {\r\n        this.valid = false;\r\n        return;\r\n        //throw new Error('Texture Error: frame does not fit inside the base Texture dimensions ' + this);\r\n    }"},"comment":{"url":"https://api.github.com/repos/photonstorm/phaser/issues/comments/71408433","html_url":"https://github.com/photonstorm/phaser/issues/1556#issuecomment-71408433","issue_url":"https://api.github.com/repos/photonstorm/phaser/issues/1556","id":71408433,"user":{"login":"photonstorm","id":164476,"avatar_url":"https://avatars.githubusercontent.com/u/164476?v=3","gravatar_id":"","url":"https://api.github.com/users/photonstorm","html_url":"https://github.com/photonstorm","followers_url":"https://api.github.com/users/photonstorm/followers","following_url":"https://api.github.com/users/photonstorm/following{/other_user}","gists_url":"https://api.github.com/users/photonstorm/gists{/gist_id}","starred_url":"https://api.github.com/users/photonstorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/photonstorm/subscriptions","organizations_url":"https://api.github.com/users/photonstorm/orgs","repos_url":"https://api.github.com/users/photonstorm/repos","events_url":"https://api.github.com/users/photonstorm/events{/privacy}","received_events_url":"https://api.github.com/users/photonstorm/received_events","type":"User","site_admin":false},"created_at":"2015-01-26T02:43:22Z","updated_at":"2015-01-26T02:43:22Z","body":"It's not a file error though, so the loader shouldn't fire it. The image *loaded* fine. It's just that you gave it bogus dimensions so the sprite sheet parser can't chop it up the way you've told it to. You need to give it accurate dimensions. If that means taking the source image width/height and doing a little simple division to work out if the given frame dimensions are right or not, then so be it - that's what needs to be done.\r\n\r\nAlternatively patch your copy of Pixi to get around the error it throws, but it's not something that should be done on a framework level - because fundamentally the dimensions it was given were *wrong*. I think it's fair of Pixi to expect it is given the correct frame dimensions when creating a texture, and if there's any possibility they might be wrong then they need validating in userland code before it's asked to make a texture with them."}}