Git fork
at reftables-rust 46 lines 1.1 kB view raw
1/* 2 * Copyright 2020 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style 5 * license that can be found in the LICENSE file or at 6 * https://developers.google.com/open-source/licenses/bsd 7 */ 8 9#include "system.h" 10#include "reftable-error.h" 11 12#include <stdio.h> 13 14const char *reftable_error_str(int err) 15{ 16 static char buf[250]; 17 switch (err) { 18 case REFTABLE_IO_ERROR: 19 return "I/O error"; 20 case REFTABLE_FORMAT_ERROR: 21 return "corrupt reftable file"; 22 case REFTABLE_NOT_EXIST_ERROR: 23 return "file does not exist"; 24 case REFTABLE_LOCK_ERROR: 25 return "data is locked"; 26 case REFTABLE_API_ERROR: 27 return "misuse of the reftable API"; 28 case REFTABLE_ZLIB_ERROR: 29 return "zlib failure"; 30 case REFTABLE_EMPTY_TABLE_ERROR: 31 return "wrote empty table"; 32 case REFTABLE_REFNAME_ERROR: 33 return "invalid refname"; 34 case REFTABLE_ENTRY_TOO_BIG_ERROR: 35 return "entry too large"; 36 case REFTABLE_OUTDATED_ERROR: 37 return "data concurrently modified"; 38 case REFTABLE_OUT_OF_MEMORY_ERROR: 39 return "out of memory"; 40 case -1: 41 return "general error"; 42 default: 43 snprintf(buf, sizeof(buf), "unknown error code %d", err); 44 return buf; 45 } 46}