Skip to content

feat: add error_message to Query.Response - #55

Merged
Rezenders merged 1 commit into
typedb2from
fix/u1-error-message
Jun 25, 2026
Merged

Rezenders merged 1 commit into
typedb2from
fix/u1-error-message

Conversation

@Rezenders

Copy link
Copy Markdown
Member

Summary

  • Adds string error_message to Query.srv response (after bool success)
  • Adds TypeDBInterface.last_error: str = '' attribute, reset at the start of each DB method and populated with str(err) in each except block (insert_database, update_database, delete_from_database, define_database, fetch_database, get_database, get_aggregate_database)
  • query_service_cb now sets response.error_message = self.typedb_interface.last_error on failure, or f'Unknown query type: {req.query_type}' for unrecognised query types

Test plan

  • Trigger a query failure (e.g., invalid TypeQL syntax) and assert response.success is False and response.error_message is non-empty
  • Successful query: response.error_message is ''
  • Unknown query_type: response.success is False and error_message contains the type value

🤖 Generated with Claude Code

When success=False, callers currently get no actionable failure reason —
the error is logged server-side only. This adds:
- string error_message field to Query.srv response
- TypeDBInterface.last_error attribute, populated in every DB method
  except block, reset to '' at the start of each method
- query_service_cb populates response.error_message from last_error on
  failure, or with 'Unknown query type: N' for unrecognised query types

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Rezenders
Rezenders merged commit 1790dd2 into typedb2 Jun 25, 2026
2 checks passed
@Rezenders
Rezenders deleted the fix/u1-error-message branch June 25, 2026 11:39
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