Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/cairo: Add cairo status to error message #2378

Merged
merged 1 commit into from
May 18, 2022

Conversation

wenzeslaus
Copy link
Member

The original message about failing to initialize a Cairo surface does not include any reason. This adds size and status from Cairo.

Comparison

Original

ERROR: Failed to initialize Cairo surface

New

ERROR: Failed to initialize Cairo surface (width: 100000, height: 100000):
       invalid value (typically too big) for the size of the input
       (surface, pattern, etc.)

The result depends on what message is generated by Cairo.

In action

> d.mon stop=cairo; d.mon start=cairo width=10000 height=10000 --o; d.rast map=dsm; d.mon stop=cairo
WARNING: File <map.png> already exists and will be overwritten
Output file: /home/vpetras/Projects/grass/code/grass/map.png
 100%
> d.mon start=cairo width=100000 height=10000 --o; d.rast map=dsm; d.mon stop=cairo
Current region rows: 1991, cols: 2027
ERROR: G_malloc: unable to allocate 18446744073414584320 bytes of memory at
       lib/cairodriver/graph.c:210
> d.mon start=cairo width=100000 height=100000 --o; d.rast map=dsm; d.mon stop=cairo
ERROR: Failed to initialize Cairo surface (width: 100000, height: 100000):
       invalid value (typically too big) for the size of the input
       (surface, pattern, etc.)

The original message about failing to initialize a Cairo surface does not include any reason. This adds size and status from cairo.
@wenzeslaus wenzeslaus added the enhancement New feature or request label May 17, 2022
@wenzeslaus wenzeslaus added this to the 8.4.0 milestone May 17, 2022
@neteler
Copy link
Member

neteler commented May 17, 2022

This is a nice improvement, I just tested it locally:

image

which looks much better than before (compare #2376 (comment)).

@wenzeslaus wenzeslaus modified the milestones: 8.4.0, 8.2.0 May 18, 2022
@wenzeslaus
Copy link
Member Author

Thanks @neteler. Given the context of your test, I take it you vote for backporting this to 8.2. The cairo function is available since 1.0 and otherwise it is minimal and after-error code only, so backporting to 8.2 is reasonable.

@wenzeslaus wenzeslaus merged commit 30cca6b into OSGeo:main May 18, 2022
@wenzeslaus wenzeslaus deleted the cairo-status-string branch May 18, 2022 14:56
wenzeslaus added a commit that referenced this pull request May 24, 2022
The original message about failing to initialize a Cairo surface does not include any reason. This adds size and status from Cairo.
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
The original message about failing to initialize a Cairo surface does not include any reason. This adds size and status from Cairo.
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
The original message about failing to initialize a Cairo surface does not include any reason. This adds size and status from Cairo.
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
The original message about failing to initialize a Cairo surface does not include any reason. This adds size and status from Cairo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants