Tabnine Logo
ErrorNamespace
Code IndexAdd Tabnine to your IDE (free)

How to use
ErrorNamespace
in
com.palantir.conjure.spec

Best Java code snippets using com.palantir.conjure.spec.ErrorNamespace (Showing top 5 results out of 315)

origin: palantir/conjure

@Test
public void testValidErrorNamespaces() throws Exception {
  ErrorNamespaceValidator.validate(ErrorNamespace.of("Conjure"));
  ErrorNamespaceValidator.validate(ErrorNamespace.of("PalantirFoo"));
  ErrorNamespaceValidator.validate(ErrorNamespace.of("PalantirFooBar"));
}
origin: palantir/conjure

  public static void validate(ErrorNamespace name) {
    Preconditions.checkArgument(UPPER_CAMEL_CASE.matcher(name.get()).matches(),
        "Namespace for errors must match pattern %s: %s", UPPER_CAMEL_CASE, name);
  }
}
origin: palantir/conjure

@Test
public void testInvalidErrorNamespaces() {
  for (String invalid : new String[] {
      "conjure",
      "palantirFoo",
      "palantir-foo",
      "PALANTIR-FOO",
      "palantir_foo",
      "PALANTIR_FOO"
  }) {
    assertThatThrownBy(() -> ErrorNamespaceValidator.validate(ErrorNamespace.of(invalid)))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessageContaining("Namespace for errors must match pattern")
        .hasMessageContaining(invalid);
  }
}
origin: palantir/conjure

public static ErrorDefinition parseErrorType(
    TypeName name,
    com.palantir.conjure.parser.types.complex.ErrorTypeDefinition def,
    ConjureTypeParserVisitor.ReferenceTypeResolver typeResolver) {
  ErrorDefinition errorType = ErrorDefinition.builder()
      .errorName(name)
      .namespace(ErrorNamespace.of(def.namespace().name()))
      .code(def.code().asSpecErrorCode())
      .safeArgs(parseField(def.safeArgs(), typeResolver))
      .unsafeArgs(parseField(def.unsafeArgs(), typeResolver))
      .docs(def.docs().map(Documentation::of))
      .build();
  ErrorDefinitionValidator.validate(errorType);
  return errorType;
}
origin: palantir/conjure

ErrorDefinition definition1 = ErrorDefinition.builder()
    .errorName(TypeName.of("Foo", "package"))
    .namespace(ErrorNamespace.of("Test"))
    .code(ErrorCode.INVALID_ARGUMENT)
    .safeArgs(safeArg1)
ErrorDefinition definition2 = ErrorDefinition.builder()
    .errorName(TypeName.of("Foo", "package"))
    .namespace(ErrorNamespace.of("Test"))
    .code(ErrorCode.INVALID_ARGUMENT)
    .safeArgs(safeArg2)
com.palantir.conjure.specErrorNamespace

Most used methods

  • of
  • get

Popular in Java

  • Finding current android device location
  • onRequestPermissionsResult (Fragment)
  • getSharedPreferences (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • JFrame (javax.swing)
  • JList (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now