diff options
author | Kevin Sawicki | 2011-09-11 19:55:30 +0000 |
---|---|---|
committer | Kevin Sawicki | 2011-09-11 19:55:30 +0000 |
commit | bfbbf3d66b312f5cb9375ea34f6d5670791ba618 (patch) | |
tree | 47c32cc720aaf55e66f3cbfd681e8e7d720d1b89 /org.eclipse.egit.github.core/src | |
parent | a850e9b287b7203d974f077eb2c2ecf7d5409f73 (diff) | |
download | egit-github-bfbbf3d66b312f5cb9375ea34f6d5670791ba618.tar.gz egit-github-bfbbf3d66b312f5cb9375ea34f6d5670791ba618.tar.xz egit-github-bfbbf3d66b312f5cb9375ea34f6d5670791ba618.zip |
Add message for field error code of already_exists
Change-Id: I020f1e80aa36ee1dd5070d79fb8e58ad4640e3b4
Signed-off-by: Kevin Sawicki <kevin@github.com>
Diffstat (limited to 'org.eclipse.egit.github.core/src')
-rw-r--r-- | org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java index 8cd7bca9..e9c7b6b9 100644 --- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java +++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.egit.github.core.client; +import static org.eclipse.egit.github.core.FieldError.CODE_ALREADY_EXISTS; import static org.eclipse.egit.github.core.FieldError.CODE_INVALID; import static org.eclipse.egit.github.core.FieldError.CODE_MISSING_FIELD; @@ -33,6 +34,8 @@ public class RequestException extends IOException { private static final String FIELD_ERROR = "Error with field ''{0}'' in {1} resource"; //$NON-NLS-1$ + private static final String FIELD_EXISTS = "{0} resource with field ''{1}'' already exists"; //$NON-NLS-1$ + /** * serialVersionUID */ @@ -85,17 +88,22 @@ public class RequestException extends IOException { String code = error.getCode(); String value = error.getValue(); String field = error.getField(); + if (CODE_INVALID.equals(code)) if (value != null) return MessageFormat.format(FIELD_INVALID_WITH_VALUE, value, field); else return MessageFormat.format(FIELD_INVALID, field); + if (CODE_MISSING_FIELD.equals(code)) return MessageFormat.format(FIELD_MISSING, field); - else - return MessageFormat - .format(FIELD_ERROR, field, error.getResource()); + + if (CODE_ALREADY_EXISTS.equals(code)) + return MessageFormat.format(FIELD_EXISTS, error.getResource(), + field); + + return MessageFormat.format(FIELD_ERROR, field, error.getResource()); } /** |