59 lines
1.6 KiB
Markdown
59 lines
1.6 KiB
Markdown
|
```wmd-options
|
||
|
language = es
|
||
|
title_i18n = errors_manager_title_to_unknown
|
||
|
title_text = to_unknown - ErrorsManager
|
||
|
```
|
||
|
|
||
|
<!-- [[wmd]] -->
|
||
|
|
||
|
### to_unknown
|
||
|
|
||
|
[[@ [Any|null] ErrorsManager.to_unknown(?Any code)]]
|
||
|
|
||
|
El método **to_unknown** es un método objeto que sirve para ejecutar en caso de ser un tipado no conocido por la librería como código de error. Básicamente retorna el mismo valor que se le da.
|
||
|
|
||
|
```py
|
||
|
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
from Assets.ErrorsManager import ErrorsManager
|
||
|
|
||
|
errors_manager:ErrorsManager = ErrorsManager()
|
||
|
|
||
|
print(["Prueba 1", errors_manager.to_unknown(105)])
|
||
|
print(["Prueba 2", errors_manager.to_unknown("pB")])
|
||
|
print(["Prueba 3", errors_manager.to_unknown([41, 1])])
|
||
|
print(["Prueba 4", errors_manager.to_unknown(None)])
|
||
|
print(["Prueba 5", errors_manager.to_unknown(errors_manager)])
|
||
|
print(["Prueba 5", errors_manager.to_unknown(True)])
|
||
|
|
||
|
```
|
||
|
|
||
|
```js
|
||
|
"use strict";
|
||
|
|
||
|
/** @type {ErrorsManager} */
|
||
|
const errors_manager = new ErrorsManager();
|
||
|
|
||
|
console.log(["Prueba 1", errors_manager.to_unknown(105)]);
|
||
|
console.log(["Prueba 2", errors_manager.to_unknown("pB")]);
|
||
|
console.log(["Prueba 3", errors_manager.to_unknown([41, 1])]);
|
||
|
console.log(["Prueba 4", errors_manager.to_unknown(null)]);
|
||
|
console.log(["Prueba 5", errors_manager.to_unknown(errors_manager)]);
|
||
|
console.log(["Prueba 5", errors_manager.to_unknown(true)]);
|
||
|
|
||
|
```
|
||
|
|
||
|
Los resultados serían los siguientes:
|
||
|
|
||
|
[|
|
||
|
|= Prueba | Python | Javascript
|
||
|
| 1 || 105
|
||
|
| 2 || "pB"
|
||
|
| 3 || \[41, 1]
|
||
|
| 4 | None | null
|
||
|
| 5 || errors_manager\[ErrorsManager]
|
||
|
| 6 | True | true
|
||
|
|]
|
||
|
|
||
|
<!-- [[wmd]] -->
|