1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.chromium.mojo.system; 6 7 /** 8 * The different mojo result codes. 9 */ 10 public final class MojoResult { 11 public static final int OK = 0; 12 public static final int CANCELLED = 1; 13 public static final int UNKNOWN = 2; 14 public static final int INVALID_ARGUMENT = 3; 15 public static final int DEADLINE_EXCEEDED = 4; 16 public static final int NOT_FOUND = 5; 17 public static final int ALREADY_EXISTS = 6; 18 public static final int PERMISSION_DENIED = 7; 19 public static final int RESOURCE_EXHAUSTED = 8; 20 public static final int FAILED_PRECONDITION = 9; 21 public static final int ABORTED = 10; 22 public static final int OUT_OF_RANGE = 11; 23 public static final int UNIMPLEMENTED = 12; 24 public static final int INTERNAL = 13; 25 public static final int UNAVAILABLE = 14; 26 public static final int DATA_LOSS = 15; 27 public static final int BUSY = 16; 28 public static final int SHOULD_WAIT = 17; 29 30 /** 31 * never instantiate. 32 */ MojoResult()33 private MojoResult() { 34 } 35 36 /** 37 * Describes the given result code. 38 */ describe(int mCode)39 public static String describe(int mCode) { 40 switch (mCode) { 41 case OK: 42 return "OK"; 43 case CANCELLED: 44 return "CANCELLED"; 45 case UNKNOWN: 46 return "UNKNOWN"; 47 case INVALID_ARGUMENT: 48 return "INVALID_ARGUMENT"; 49 case DEADLINE_EXCEEDED: 50 return "DEADLINE_EXCEEDED"; 51 case NOT_FOUND: 52 return "NOT_FOUND"; 53 case ALREADY_EXISTS: 54 return "ALREADY_EXISTS"; 55 case PERMISSION_DENIED: 56 return "PERMISSION_DENIED"; 57 case RESOURCE_EXHAUSTED: 58 return "RESOURCE_EXHAUSTED"; 59 case FAILED_PRECONDITION: 60 return "FAILED_PRECONDITION"; 61 case ABORTED: 62 return "ABORTED"; 63 case OUT_OF_RANGE: 64 return "OUT_OF_RANGE"; 65 case UNIMPLEMENTED: 66 return "UNIMPLEMENTED"; 67 case INTERNAL: 68 return "INTERNAL"; 69 case UNAVAILABLE: 70 return "UNAVAILABLE"; 71 case DATA_LOSS: 72 return "DATA_LOSS"; 73 case BUSY: 74 return "BUSY"; 75 case SHOULD_WAIT: 76 return "SHOULD_WAIT"; 77 default: 78 return "UNKNOWN"; 79 } 80 81 } 82 } 83