Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
89a38727
Commit
89a38727
authored
8 years ago
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1611: incorrect error code for negative tests (#2)
parent
de7ae290
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
AtlasErrorCode.java
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+3
-1
AtlasInstanceConverter.java
...e/atlas/repository/converters/AtlasInstanceConverter.java
+8
-3
No files found.
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
View file @
89a38727
...
@@ -67,6 +67,7 @@ public enum AtlasErrorCode {
...
@@ -67,6 +67,7 @@ public enum AtlasErrorCode {
INSTANCE_LINEAGE_INVALID_PARAMS
(
400
,
"ATLAS-400-00-026"
,
"Invalid lineage query parameters passed {0}: {1}"
),
INSTANCE_LINEAGE_INVALID_PARAMS
(
400
,
"ATLAS-400-00-026"
,
"Invalid lineage query parameters passed {0}: {1}"
),
ATTRIBUTE_UPDATE_NOT_SUPPORTED
(
400
,
"ATLAS-400-00-027"
,
"{0}.{1} : attribute update not supported"
),
ATTRIBUTE_UPDATE_NOT_SUPPORTED
(
400
,
"ATLAS-400-00-027"
,
"{0}.{1} : attribute update not supported"
),
INVALID_VALUE
(
400
,
"ATLAS-400-00-028"
,
"invalid value: {0}"
),
INVALID_VALUE
(
400
,
"ATLAS-400-00-028"
,
"invalid value: {0}"
),
BAD_REQUEST
(
400
,
"ATLAS-400-00-020"
,
"{0}"
),
// All Not found enums go here
// All Not found enums go here
TYPE_NAME_NOT_FOUND
(
404
,
"ATLAS-404-00-001"
,
"Given typename {0} was invalid"
),
TYPE_NAME_NOT_FOUND
(
404
,
"ATLAS-404-00-001"
,
"Given typename {0} was invalid"
),
...
@@ -78,11 +79,12 @@ public enum AtlasErrorCode {
...
@@ -78,11 +79,12 @@ public enum AtlasErrorCode {
CLASSIFICATION_NOT_FOUND
(
404
,
"ATLAS-404-00-008"
,
"Given classification {0} was invalid"
),
CLASSIFICATION_NOT_FOUND
(
404
,
"ATLAS-404-00-008"
,
"Given classification {0} was invalid"
),
INSTANCE_BY_UNIQUE_ATTRIBUTE_NOT_FOUND
(
404
,
"ATLAS-404-00-009"
,
"Instance {0} with unique attribute {1} does not exist"
),
INSTANCE_BY_UNIQUE_ATTRIBUTE_NOT_FOUND
(
404
,
"ATLAS-404-00-009"
,
"Instance {0} with unique attribute {1} does not exist"
),
REFERENCED_ENTITY_NOT_FOUND
(
404
,
"ATLAS-404-00-00A"
,
"Referenced entity {0} is not found"
),
REFERENCED_ENTITY_NOT_FOUND
(
404
,
"ATLAS-404-00-00A"
,
"Referenced entity {0} is not found"
),
INSTANCE_NOT_FOUND
(
404
,
"ATLAS-404-00-00B"
,
"Given instance is invalid/not found: {0}"
),
// All data conflict errors go here
// All data conflict errors go here
TYPE_ALREADY_EXISTS
(
409
,
"ATLAS-409-00-001"
,
"Given type {0} already exists"
),
TYPE_ALREADY_EXISTS
(
409
,
"ATLAS-409-00-001"
,
"Given type {0} already exists"
),
TYPE_HAS_REFERENCES
(
409
,
"ATLAS-409-00-002"
,
"Given type {0} has references"
),
TYPE_HAS_REFERENCES
(
409
,
"ATLAS-409-00-002"
,
"Given type {0} has references"
),
INSTANCE_ALREADY_EXISTS
(
409
,
"ATLAS-409-00-003"
,
"
Given entity {0} already exists
"
),
INSTANCE_ALREADY_EXISTS
(
409
,
"ATLAS-409-00-003"
,
"
failed to update entity: {0}
"
),
// All internal errors go here
// All internal errors go here
INTERNAL_ERROR
(
500
,
"ATLAS-500-00-001"
,
"Internal server error {0}"
),
INTERNAL_ERROR
(
500
,
"ATLAS-500-00-001"
,
"Internal server error {0}"
),
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
View file @
89a38727
...
@@ -45,6 +45,7 @@ import org.apache.atlas.typesystem.ITypedReferenceableInstance;
...
@@ -45,6 +45,7 @@ import org.apache.atlas.typesystem.ITypedReferenceableInstance;
import
org.apache.atlas.typesystem.ITypedStruct
;
import
org.apache.atlas.typesystem.ITypedStruct
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Struct
;
import
org.apache.atlas.typesystem.Struct
;
import
org.apache.atlas.typesystem.exception.EntityExistsException
;
import
org.apache.atlas.typesystem.exception.EntityNotFoundException
;
import
org.apache.atlas.typesystem.exception.EntityNotFoundException
;
import
org.apache.atlas.typesystem.exception.TraitNotFoundException
;
import
org.apache.atlas.typesystem.exception.TraitNotFoundException
;
import
org.apache.atlas.typesystem.exception.TypeNotFoundException
;
import
org.apache.atlas.typesystem.exception.TypeNotFoundException
;
...
@@ -199,19 +200,23 @@ public class AtlasInstanceConverter {
...
@@ -199,19 +200,23 @@ public class AtlasInstanceConverter {
}
}
public
static
AtlasBaseException
toAtlasBaseException
(
AtlasException
e
)
{
public
static
AtlasBaseException
toAtlasBaseException
(
AtlasException
e
)
{
if
(
e
instanceof
EntityExistsException
)
{
return
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_ALREADY_EXISTS
,
e
.
getMessage
());
}
if
(
e
instanceof
EntityNotFoundException
||
e
instanceof
TraitNotFoundException
)
{
if
(
e
instanceof
EntityNotFoundException
||
e
instanceof
TraitNotFoundException
)
{
return
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_
GUID_NOT_FOUND
,
e
);
return
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_
NOT_FOUND
,
e
.
getMessage
()
);
}
}
if
(
e
instanceof
TypeNotFoundException
)
{
if
(
e
instanceof
TypeNotFoundException
)
{
return
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_NAME_NOT_FOUND
,
e
);
return
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_NAME_NOT_FOUND
,
e
.
getMessage
()
);
}
}
if
(
e
instanceof
ValueConversionException
)
{
if
(
e
instanceof
ValueConversionException
)
{
return
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_VALUE
,
e
,
e
.
getMessage
());
return
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_VALUE
,
e
,
e
.
getMessage
());
}
}
return
new
AtlasBaseException
(
e
);
return
new
AtlasBaseException
(
AtlasErrorCode
.
BAD_REQUEST
,
e
.
getMessage
()
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment