Skip to content

Name the C function and PETSc's message in PetscError - #315

Merged
filoferra merged 1 commit into
JuliaParallel:mainfrom
filoferra:petsc-error-message
Oct 21, 2026
Merged

filoferra merged 1 commit into
JuliaParallel:mainfrom
filoferra:petsc-error-message

Conversation

@filoferra

Copy link
Copy Markdown
Collaborator

A failing PETSc call used to surface in Julia as PetscError(56) and nothing else; the explanation only went to stderr. The error now records the C function Julia called and PETSc's message, and prints them:

PetscError(56) from VecSetSizes: No support for this operation for this
object type. Cannot change/reset vector sizes to 4 local 4 global after
previously setting them to 3 local 3 global

PetscError(code) and err.code are unchanged. @chk takes the function name from the ccall it wraps, so the generated wrappers need no regeneration, and a successful call runs exactly as before.

A PetscError now carries the C function the failing call went to and PETSc's text for the error, read as soon as the call fails, and prints both: "PetscError(56) from VecSetSizes: No support for this operation for this object type. Cannot change/reset vector sizes ...". Before it would only have printed "PetscError(56)". PetscError(code) and err.code work as before.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@filoferra
filoferra merged commit 7546d2d into JuliaParallel:main Oct 21, 2026
5 checks passed
@filoferra
filoferra deleted the petsc-error-message branch October 21, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant