* Adds KTLint as a GitHub action * Adds KTLint to the gradle project for IDE integration * Adds .editorconfig to configure KTLint (android/)
23 lines
770 B
Kotlin
23 lines
770 B
Kotlin
package com.mrousavy.camera.utils
|
|
|
|
import com.facebook.react.bridge.*
|
|
|
|
private fun makeErrorCauseMap(throwable: Throwable): ReadableMap {
|
|
val map = Arguments.createMap()
|
|
map.putString("message", throwable.message)
|
|
map.putString("stacktrace", throwable.stackTraceToString())
|
|
if (throwable.cause != null) {
|
|
map.putMap("cause", makeErrorCauseMap(throwable.cause!!))
|
|
}
|
|
return map
|
|
}
|
|
|
|
fun makeErrorMap(code: String? = null, message: String? = null, throwable: Throwable? = null, userInfo: WritableMap? = null): ReadableMap {
|
|
val map = Arguments.createMap()
|
|
map.putString("code", code)
|
|
map.putString("message", message)
|
|
map.putMap("cause", if (throwable != null) makeErrorCauseMap(throwable) else null)
|
|
map.putMap("userInfo", userInfo)
|
|
return map
|
|
}
|