Skip to content

Commit

Permalink
get rid of all vlang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sameh-farouk committed Aug 21, 2023
1 parent a370cef commit afc66bb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions 3bot/vgrid/gridproxy/gridproxy_core.v
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
err_json_parse = 10
err_http_client = 11
err_invalid_resp = 24
err_grid_client = 30
)

// get_node_by_id fetchs specific node information by node id.
Expand Down
2 changes: 1 addition & 1 deletion 3bot/vgrid/gridproxy/gridproxy_factory.v
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ pub fn get(net TFGridNet, use_redis_cache bool) !&GridProxyClient {
}
f.instances[netstr] = &connection
}
return f.instances[netstr]
return f.instances[netstr] or { return error_with_code('http client error: unknow error happened while trying to access the GridProxyClient instance', err_grid_client) }
}
8 changes: 4 additions & 4 deletions 3bot/vgrid/gridproxy/gridproxy_highlevel.v
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import gridproxy.model { ContractFilter, ContractIterator, Farm, FarmFilter, Far
// * `twin_id`: twin id.
//
// returns: `Twin` or `Error`.
pub fn (mut c GridProxyClient) get_twin_by_id(twin_id u64) ?Twin {
pub fn (mut c GridProxyClient) get_twin_by_id(twin_id u64) !Twin {
twins := c.get_twins(twin_id: twin_id) or {
return error_with_code('http client error: ${err.msg()}', err_http_client)
}
Expand All @@ -22,7 +22,7 @@ pub fn (mut c GridProxyClient) get_twin_by_id(twin_id u64) ?Twin {
// * `account_id`: account id.
//
// returns: `Twin` or `Error`.
pub fn (mut c GridProxyClient) get_twin_by_account(account_id string) ?Twin {
pub fn (mut c GridProxyClient) get_twin_by_account(account_id string) !Twin {
twins := c.get_twins(account_id: account_id) or {
return error_with_code('http client error: ${err.msg()}', err_http_client)
}
Expand All @@ -37,7 +37,7 @@ pub fn (mut c GridProxyClient) get_twin_by_account(account_id string) ?Twin {
// * `farm_id`: farm id.
//
// returns: `Farm` or `Error`.
pub fn (mut c GridProxyClient) get_farm_by_id(farm_id u64) ?Farm {
pub fn (mut c GridProxyClient) get_farm_by_id(farm_id u64) !Farm {
farms := c.get_farms(farm_id: farm_id) or {
return error_with_code('http client error: ${err.msg()}', err_http_client)
}
Expand All @@ -52,7 +52,7 @@ pub fn (mut c GridProxyClient) get_farm_by_id(farm_id u64) ?Farm {
// * `farm_name`: farm name.
//
// returns: `Farm` or `Error`.
pub fn (mut c GridProxyClient) get_farm_by_name(farm_name string) ?Farm {
pub fn (mut c GridProxyClient) get_farm_by_name(farm_name string) !Farm {
farms := c.get_farms(name: farm_name) or {
return error_with_code('http client error: ${err.msg()}', err_http_client)
}
Expand Down
8 changes: 4 additions & 4 deletions 3bot/vgrid/gridproxy/model/iterators.v
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub struct NodeIterator {
pub mut:
filter NodeFilter
pub:
get_func NodeGetter
get_func NodeGetter [required]
}

pub fn (mut i NodeIterator) next() ?[]Node {
Expand All @@ -31,7 +31,7 @@ pub struct FarmIterator {
pub mut:
filter FarmFilter
pub:
get_func FarmGetter
get_func FarmGetter [required]
}

pub fn (mut i FarmIterator) next() ?[]Farm {
Expand All @@ -56,7 +56,7 @@ pub struct ContractIterator {
pub mut:
filter ContractFilter
pub:
get_func ContractGetter
get_func ContractGetter [required]
}

pub fn (mut i ContractIterator) next() ?[]Contract {
Expand All @@ -81,7 +81,7 @@ pub struct TwinIterator {
pub mut:
filter TwinFilter
pub:
get_func TwinGetter
get_func TwinGetter [required]
}

pub fn (mut i TwinIterator) next() ?[]Twin {
Expand Down

0 comments on commit afc66bb

Please sign in to comment.