Skip to content

Comments

[Core] Implement Error Handler / Callback#105

Merged
nicbarker merged 11 commits intomainfrom
013-error-handler
Dec 26, 2024
Merged

[Core] Implement Error Handler / Callback#105
nicbarker merged 11 commits intomainfrom
013-error-handler

Conversation

@nicbarker
Copy link
Owner

@nicbarker nicbarker commented Dec 25, 2024

This PR changes Clay_Initialize to require that the user provide a function that Clay can call when it encounters an error.
The current error types include:

typedef enum {
    CLAY_ERROR_TYPE_TEXT_MEASUREMENT_FUNCTION_NOT_PROVIDED,
    CLAY_ERROR_TYPE_ARENA_CAPACITY_EXCEEDED,
    CLAY_ERROR_TYPE_ELEMENTS_CAPACITY_EXCEEDED,
    CLAY_ERROR_TYPE_TEXT_MEASUREMENT_CAPACITY_EXCEEDED,
    CLAY_ERROR_TYPE_DUPLICATE_ID,
    CLAY_ERROR_TYPE_FLOATING_CONTAINER_PARENT_NOT_FOUND,
    CLAY_ERROR_TYPE_INTERNAL_ERROR,
} Clay_ErrorType;

This is part of work to allow the user to handle the case where clay runs out of space in its internal arena, and needs to reallocate with more memory.

uint64_t nextAllocation;
uint64_t capacity;
uintptr_t nextAllocation;
size_t capacity;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small types cleanup here. Should be transparent

@nicbarker nicbarker merged commit 04694b0 into main Dec 26, 2024
3 checks passed
appe12341 added a commit to appe12341/clay that referenced this pull request Dec 26, 2024
@nicbarker nicbarker deleted the 013-error-handler branch January 9, 2025 20:41
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.

2 participants