FBErrorBuilder.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import <Foundation/Foundation.h>
  10. NS_ASSUME_NONNULL_BEGIN
  11. /**
  12. Builder used create error raised by WebDriverAgent
  13. */
  14. @interface FBErrorBuilder : NSObject
  15. /**
  16. Default constructor
  17. */
  18. + (instancetype)builder;
  19. /**
  20. Configures description set as NSLocalizedDescriptionKey
  21. @param description set as NSLocalizedDescriptionKey
  22. @return builder instance
  23. */
  24. - (instancetype)withDescription:(NSString *)description;
  25. /**
  26. Configures description set as NSLocalizedDescriptionKey with convenient format
  27. @param format of description set as NSLocalizedDescriptionKey
  28. @return builder instance
  29. */
  30. - (instancetype)withDescriptionFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2);
  31. /**
  32. Configures error set as NSUnderlyingErrorKey
  33. @param innerError used to set NSUnderlyingErrorKey
  34. @return builder instance
  35. */
  36. - (instancetype)withInnerError:(NSError *)innerError;
  37. /**
  38. Builder used create error raised by WebDriverAgent
  39. @return built error
  40. */
  41. - (NSError *)build;
  42. /**
  43. Builder used create error raised by WebDriverAgent
  44. @param error pointer used to return built error
  45. @return fixed NO to apply to Apple's coding conventions
  46. */
  47. - (BOOL)buildError:(NSError **)error;
  48. @end
  49. NS_ASSUME_NONNULL_END