Skip to content

Conversation

@jbinney
Copy link
Contributor

@jbinney jbinney commented Nov 1, 2015

If you attempt to visualize a view or layer with 0 width or height, you get a pretty inscrutable error message:

(lldb) visualize 0x7fa1285024b0
Nov  1 13:52:00  ChiselTestApp[87971] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Nov  1 13:52:00  ChiselTestApp[87971] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Nov  1 13:52:00  ChiselTestApp[87971] <Error>: CGContextSetFillColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Nov  1 13:52:00  ChiselTestApp[87971] <Error>: CGContextAddRect: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Nov  1 13:52:00  ChiselTestApp[87971] <Error>: CGContextDrawPath: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Nov  1 13:52:00  ChiselTestApp[87971] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Nov  1 13:52:00  ChiselTestApp[87971] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Could not get image data.

With this change, we proactively generate a more user-friendly error message when the width or height of a layer is 0:

(lldb) visualize 0x7ff3fca37030
Nothing to see here - the size of this element is 0.0 x 1.5.

arigrant added a commit that referenced this pull request Nov 1, 2015
[visualize] User-friendly error message for widthless/heightless layers
@arigrant arigrant merged commit 0d2f24d into facebook:master Nov 1, 2015
@arigrant
Copy link
Contributor

arigrant commented Nov 1, 2015

This is great. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants