Rename BearSslError to SSLError.

This commit is contained in:
cheatfate 2019-10-08 12:31:04 +03:00
parent 134cadf55b
commit 3552a8abfa
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
1 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@
## This module provides error messages for BearSSL's error codes. ## This module provides error messages for BearSSL's error codes.
type type
BearSslError* {.pure.} = enum SSLError* {.pure.} = enum
NoError = 0, NoError = 0,
BadParam = 1, BadParam = 1,
BadState = 2, BadState = 2,
@ -162,7 +162,7 @@ const
(X509NotTrusted, "Chain could not be linked to a trust anchor") (X509NotTrusted, "Chain could not be linked to a trust anchor")
] ]
proc bearSslErrorMsg*(code: cint): string = proc sslErrorMsg*(code: cint): string =
## Converts BearSSL integer error code to string representation. ## Converts BearSSL integer error code to string representation.
if int(code) > int(SendFatalAlert): if int(code) > int(SendFatalAlert):
let err = int(code) - int(SendFatalAlert) let err = int(code) - int(SendFatalAlert)
@ -174,12 +174,12 @@ proc bearSslErrorMsg*(code: cint): string =
else: else:
for item in SSLErrors: for item in SSLErrors:
if int(item[0]) == int(code): if int(item[0]) == int(code):
result = "(" & $cast[BearSslError](code) & ") " & item[1] result = "(" & $cast[SSLError](code) & ") " & item[1]
break break
if len(result) == 0: if len(result) == 0:
result = "(" & $code & ") Unknown error" result = "(" & $code & ") Unknown error"
proc bearSslErrorMsg*(code: BearSslError): string = proc errorMsg*(code: SSLError): string =
## Converts enum error to string representation. ## Converts enum error to string representation.
for item in SSLErrors: for item in SSLErrors:
if item[0] == code: if item[0] == code: