1 module vksdk.objects.base.BaseError; 2 3 import vibe.data.json; 4 5 import vksdk.objects.base.RequestParam; 6 7 struct BaseError { 8 9 @name("error_code") 10 int errorCode; 11 12 @name("error_msg") 13 string errorMsg; 14 15 @name("captcha_sid") 16 string captchaSid; 17 18 @name("captcha_img") 19 string captchaImgUrl; 20 21 /** 22 * Confirmation text for user 23 */ 24 @name("confirmation_text") 25 string confirmationText; 26 27 /** 28 * Redirect uri for validation request 29 */ 30 @name("redirect_uri") 31 string redirectUri; 32 33 @name("request_params") 34 RequestParam[] requestParams; 35 36 size_t toHash() const pure nothrow { 37 size_t hash = errorCode.hashOf(); 38 hash = requestParams.hashOf(hash); 39 hash = errorMsg.hashOf(hash); 40 return hash; 41 } 42 43 bool opEquals(BaseError error) const @safe pure nothrow { 44 return (errorCode == error.errorCode && 45 errorMsg == error.errorMsg && 46 requestParams == error.requestParams); 47 } 48 49 string toString() { 50 import std.conv; 51 52 return "Error{" 53 ~ "errorCode=" ~ to!string(errorCode) 54 ~ ", errorMsg='" ~ errorMsg ~ "'" 55 ~ ", captchaSid='" ~ captchaSid ~ "'" 56 ~ ", captchaImgUrl='" ~ captchaImgUrl ~ "'" 57 ~ ", confirmationText='" ~ confirmationText ~ "'" 58 ~ ", redirectUri='" ~ redirectUri ~ "'" 59 ~ ", requestParams=" ~ to!(string)(requestParams) 60 ~ "}"; 61 } 62 }