(error: IntegrationReadError)
| 70 | |
| 71 | |
| 72 | def _integration_state_error_message(error: IntegrationReadError) -> str: |
| 73 | if error.kind == "decode": |
| 74 | return _with_error_detail( |
| 75 | f"{INTEGRATION_JSON} contains invalid JSON or is not valid UTF-8.", |
| 76 | error, |
| 77 | ) |
| 78 | if error.kind == "os": |
| 79 | return _with_error_detail(f"Could not read {INTEGRATION_JSON}.", error) |
| 80 | if error.kind == "not_object": |
| 81 | return f"{INTEGRATION_JSON} must contain a JSON object, got {error.detail}." |
| 82 | if error.kind == "schema_too_new": |
| 83 | return ( |
| 84 | f"{INTEGRATION_JSON} uses integration state schema {error.schema}, " |
| 85 | f"which is newer than this CLI supports; supported schema: {INTEGRATION_STATE_SCHEMA}." |
| 86 | ) |
| 87 | return f"Could not inspect {INTEGRATION_JSON}." |
| 88 | |
| 89 | |
| 90 | def _sha256_file(path: Path) -> str: |
no test coverage detected